How to determine the exact database error in JPA?

For example you are going to add a record in the database which primary already exist
in one of the records in that table in the database. This will cause an error, but how do
I know this error in human readable form just like "Same record with the same PK in the
the table already exist" in JPA.
My current procedure is that I will first check all the records in the database in that table
and compare those PK's in the current record, if there is a conflict then I know the error.
But this procedure is so slow considering there are a lot of records in the database.
Fetch and compare is so slow.
Anyone help me on this.

For example you are going to add a record in the database which primary already existin one of the records in that table in the database. This will cause an error, but how do
I know this error in human readable form just like "Same record with the same PK in the
the table already exist" in JPA>
Why would you do that though? If you're using autogenerated keys it can't occur. If you're using business keys you should be checking for the existence of the key before trying to insert. Any other case is likely to be a bug, so don't do that.

Similar Messages

  • How to determine the exact key pressed when numlock disabled?

    Hi there,
    I am trying track the keyboardevent that triggered by pressing numpad keys as hotkey, but when the numlock is disabled, the same keycode, same keylocation was gotten as pressing in the standard keyboard. how can I determine if the numpad was pressed or the other control keys were pressed?
    Thank you!
    Andy

    Hi there,
    I am trying track the keyboardevent that triggered by pressing numpad keys as hotkey, but when the numlock is disabled, the same keycode, same keylocation was gotten as pressing in the standard keyboard. how can I determine if the numpad was pressed or the other control keys were pressed?
    Thank you!
    Andy

  • How can a servlet determine the exact requesting URL

    This seems like a simple question, but I cannot find a solution. I am wondering how a servlet can determine the exact requesting URL that invoked the servlet. Specifically, I am having trouble making my servlet determine if the port number was specified or not. I am using session tracking, and my web server (by default) produces two separate sessions when hitting https://myserver.com/myservlet and https://myserver.com:443/myservlet.
    I have tried to use the HttpUtils.getRequestURL(), but this function seems to assume that if you used https over port 443, that you DID NOT specify 443 in the URL.
    SV

    If your servlet container implements servlet 2.2 or better, try the request.getRequestURL() method. It should return everything that was originally entered for the request address at the client except the query string (use request.getQueryString() to get that).
    I am not sure how it handles the port number for specifically entered vs not specifically entered.

  • How to determine the mount point for directory /tmp ?

    Folks,
    Hello. I am installing Oracle 11gR2 RAC using 2 Virtual Machines (rac1 and rac2 whose OS are Oracle Linux 5.6) in VMPlayer and according to the tutorial
    http://appsdbaworkshop.blogspot.com/2011/10/11gr2-rac-on-linux-56-using-vmware.html
    I am installing Grid infrastructure. I am on step 7 of 10 (verify Grid installation enviroment) and get this error:
    "Free Space: Rac2: /tmp"
    Cause: Could not determine mount point for location specified.
    Action: Ensure location specified is available.
    Expected value: n/a
    Actual value: n/a
    I have checked the free space using the command:
    [root@Rac2 /]# df -k /tmp
    Output:
    Filesystem     1k-blocks     used     Available     Use%     Mounted on
    /dev/sda1     30470144     7826952     21070432     28%     /
    As you see above, the free space is enough, but could not determine mount point for /tmp.
    Do any folk understand how to determine the mount point for directory /tmp ?
    Thanks.

    I have just checked "/home/oracle/.bash_profile". But in my computer, there is no "oracle" under /home directory.Is this your first time Linux and Oracle installation? I had a brief look at your referenced link. The reason why you do not find a "oracle" user is because the instructions use "ora11g" instead, which, btw, is not standard. The directories of your installation and your installation source can be somewhat different from known standards and you will have to adjust it to your system.
    My best guess is that you have either missed something in the instructions or you need to ask the author of the blog what is wrong. The chance to find someone here who has experience with these custom instructions is probably unlikely.
    I suggest you try to locate the cluster verification tool, which should be in the bin directory of your grid installation. Alternatively you might want to check the RAC, ASM & Clusterware Installation forum: RAC, ASM & Clusterware Installation

  • How to determine the field size

    I am going to make a multiplatform application that hopefully
    will run on linux and windows 2000.If the os is 2000, then I will use
    vb.net/aspx else I'll use java servlets. I make the connection
    to the web server ( through HTTP) not directly to database server.
    So, the resultset will be stored in the String object. The columns
    will be separated by delimeter. Our problem is how to determine
    the size and type of the fields of mssql,oracle and postgres database
    so that we can include it in the String object.
    Ex.
    String sResultSet=new String();
    ResultSet rs=statement.executeQuery(sSQL);
    while(rs.next()){
    sResultset=sResultSet + rs.getString(field1) + "||" + rs.getString(field2) + "||";
    vertical bars acts as delimeter
    supposedly this is the code:
    sResultset=sResultSet + rs.getString(field1) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||" + rs.getString(field2) +"_" + rs.getFieldType() + "_"+
    rs.getFieldSize() + "||";
    supposedly this is the code if rs.getFieldType() and rs.getFieldSize() methods are existing
    Anyone can give me an idea how to get the field type and field size of the database?
    thanks in advance

    Yes, but I dont know how to do it.
    Can you give me an example of using it.
    Thanks in advance

  • How to determine the type of the jobject... similar to instanceof

    hi,
    I would like to know how to determine the jobject reference of an instance is of which class.
    this is something similar to instanceof we use in java.
    is there any thing like 'instanceof' in JNI. if there how to use it?
    i got this as objective question for which answers were(i do not remember exactly)
    1.instanceof
    2.assignedto
    i could nt het much help in googling.
    thanks in advance

    Hi
    The JNI provides a native version to the java instanceof operator, this function takes two arguments
    an object refrence and a class refrence and reports JNI_TRUE.
    jclass myclass = env->FindClass("your class name");
    if(env->IsInstanceOf(obj,myclass) == JNI_TRUE)
    // obj is of type myclass
    }Regards
    pradish

  • How to determine the maximum allowable length of a filename for Window ?

    Hi all,
    Could I know how to determine the allowable file length (the length of the absolute path) for a file in Window environment?
    Due to some reason, I generated a zip file with a very long filename ( > 170) and put in a folder(the length of the folder path around 90). The length of the absolute path is around 260.
    I used FileOutputStream with the ZipOutputStream to write out the zip file. Everything is working fine while i generating the zip file.
    However, while i try to extract some files from the zip file i just created, i encountered the error
    java.util.zip.ZipException The filename is too long.
    I am using the class ZipFile to extract the files from the zip file like the following
    String absPath = "A very long filepath which exceed 260";
    ZipFile zipF = new ZipFile(absPath);  //<-- here is the root causeIs it possible to pre-determine the maximum allowable filepath length prior i generate the zip file ? This is weird since i got no error while i created the zip file, but have problem in extracting the zip file ......
    Thanks

    Assuming you could determine the max, what would you do about it? I'd say you should just assume it will be successful, but accommodate (handle) the possible exception gracefully. Either way you're going to have to handle it as an "exception", whether you "catch" an actual "Exception" object and deal with that, or manually deal with the length exceeding the max.

  • How to determine the u2018equivalent position of the same organizationu2019?

    Hi,
    "Position change is a transfer from one position to an equivalent position within the same org reporting structure and under the same chief position"
    How to determine the u2018equivalent position of the same organizationu2019?
    Cheers.

    u can identity the position with help of the Holder
    say for ex: A is the holder of the Position for Executive now the user performent an event called change of position so he changed to Manager (here we can find the chageing on the basis of some parameter so i have taken holder as Parameter as we dont know which has changed or wht has changed)
    in this case we can use the report   RHDESC20  se38
    not an exact solution for ur question
    will try to find some other way

  • How can determine the duration of an audio file

    Hi,
    i'm making speech recognition project using java. i can capture sound by michrophone and playback it. the type of the sound is .wav.
    my question is how to determine the recording duration (for example: determine the duration for 0.25 second) because i must recorded syllable,the assumtion is needed less than 0.5 second to say a word. and then.. can this wav file be changed into... binary or integer ?
    thanks for your help

    FYI I'm newbie in Java,
    Yes, I want to limit the audio file lengths to a certain value. What should I do?
    I have read wav file using an AudioInputStream, for audio format I'm using sampleRate = 8000.0F and sampleSizeInBits = 8. My friend said if I used 8 bit for sampleSizeInBit (resolution in amplitude) the binary file should be -128 till 127 in range according to the bit. I try this code and the result is binary file which is zero, positive, and negative.
    the code
    try{
    audioInputStream.read(audioBytes);
    for (int i=0; i<audioBytes.length;i++){
    System.out.println(audioBytes);
    catch(IOException ioe){
    System.out.println("Error"+ioe);
    I'm not sure that the code is right, but it works. Should I change the audioBytes into integer before? I try this code but it doesn't work.
    int a = new int[audioBytes.length];
    for (int i=0;i<audioBytes.length;i++){
    a[i] = new Byte(audioBytes[i]).intValue();
    this binary file has been printed in console (I’m using texpad). So, how I can write that to file.txt? I'm using FileoutputStream but it doesn't work correctly. Here is the code
    FileOutputStream fos = new FileOutputStream(strFilePath);
    {audioInputStream.read(audioBytes);
    fos.write(audioBytes);
    catch (IOException ioe){
    System.out.println("Error"+ioe);
    When I open file .txt is read as character like this üüüüüüüüüüüüûüüüûüûûû ||||||| ||||||| ||||||||||||||||||||||||||||| &#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746;&#1746; (like using alt plus number)
    Edited by: anasfr on Mar 19, 2009 9:02 AM

  • Insufficient rights - How to determine the correct rights?

    All,
    Does anyone know how to determine the correct rights if you get the error message "Insufficient rights for operation"?
    In SAP backend systems you can start transaction SU53 to check your "missing" authorizations, but is something like that also possible in MDM?
    I also don't see any detailed information in the logs or reports.
    If anyone has an good suggestion, please let me know, since I don't want to do "trail and error" to know what Functions to set to Execute and what Tables/Fields to set to Read/Write (because there are quite some combinations to check).
    p.s. I've read the complete reference guide of the MDM console and sometimes it's really obvious what Functions and Tables/Fields you have to set, but for instance when I want to give authorization to maintain Relationships in the DataManager and have set the Main table and all Relationships to Read/Write and have set all Records and DataManager functions to Execute it still doesn't allow me to maintain the relationships on the records! I only get the message "insufficient rights" and it's unclear what rights are missing!
    Regards,
    Marcel

    hi Marcel,
    I doubt if we have anything in MDM to show you what authorizations are missing.However,you can check the following :
    1. What activity are you trying to perform when you get this error.
    2. Check if authorization are given in the role for that actitvity.
    3. Check how many roles are allocated to user and  Is authorization given in all roles if more than 1 role is assigned to that user?
    Please let us know answer of the queries...
    Regards,
    Vineet

  • Cannot connect to the configuration database Error in HTTPS

    Hi
    We have a SharePoint 2010 farm ,with more then 20 web application  running . I am getting  "Cannot connect to the configuration database" error in one web application when   we browse through  https 
    The same application is working  fine when we  browse through http . I am  using AAM   i have 2 web server  which is been network load balanced  and the  https traffic  comes through F5
    Kindly help to resolve the issue 
    Prabakar

    HI Prabakar,Check the below URL that exactly related to the issue.
    http://expertsharepoint.blogspot.de/2014/05/cannot-connect-to-configuration-database.html
    Anil Avula[MCP,MCSE,MCSA,MCTS,MCITP,MCSM] See Me At: http://expertsharepoint.blogspot.de/

  • SBS 2008 - How to rebuild the reporting database

    I'd like to start using the inbuilt reporting facilities in SBS2008.  But when I start up the console and click on "Reports", although I am taken to the SBS2008 console's reports screen, a couple of seconds later, the following error message
    is displayed:
    "There was an error while loading data for this page".
    When I click "Close" to close the error message, I'm left looking at the console's reports screen but with nothing shown.  The top pane simply says:
    "There are no reports to display".
    So, I then click on "Add a new report" in the right-hand pane.  Nothing happens for a couple of minutes - not even an hour glass.  Eventaully, a window opens up, headed "New Report Properties".  So, I had a go at creating
    a new report, e.g.:
    - Report Name = Test123
    - Content = Summary
    - E-Mail Options = I entered my email address
    - Schedule = I set it to daily at 9pm
    When I clicked "Ok", after a couple more minutes of thinking, it came back with:
    "The report properties cannot be saved. Reopen the Report Properties dialog, and then try again."
    I don't know how to tackle this issue.  I administer the network here but don't know SQL Server - and we don't have any SQL Server applications of our own - just the inbult ones like WSUS.
    If there is a problem with the actual reporting database, I'd be happy to rebuild it, or even reinstall SQL.   But I don't know how.   My main concern is that WSUS is running beautifully and I don't want to go anywhere near anything that might
    break it.  I would rather have no reports than lose WSUS.
    Could someone point me to some step-by-step instructions aimed at someone who knows Windows Server (to an extent) and SBS2008 - but has no knowledge of SQL Server?

    I worked through the article but hit problems.  Any thoughts would be gratefully received.
    Here's what happened:
    1. I checked that SQL Server 2005 is installed and that Windows SBS Manager is installed and started
    2. I looked for "SQLServer (SBSMONITORING)" in the list of services but it is completely missing
    I then followed the section headed "If necessary, create a new SBSMonitoring database".  This takes one to another article:
    http://blogs.technet.com/b/sbs/archive/2011/08/22/how-to-recreate-the-sbsmonitoring-database.aspx.
    I followed the instructions, which included downloading Create-SBSMonitoringDb.ps1 and running it in an administrative Power Shell.  When I ran it, I got a load of errors.
    =============================================================
    PS C:\windows\temp> .\Create-SBSMonitoringDb.ps1
    Stop-Service : Cannot find any service with service name 'MSSQL$SBSMONITORING'.
    At C:\windows\temp\Create-SBSMonitoringDb.ps1:28 char:13
    + Stop-Service <<<<  'MSSQL$SBSMONITORING'
        + CategoryInfo          : ObjectNotFound: (MSSQL$SBSMONITORING:String) [Stop-Service], ServiceCommandException
        + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.StopServiceCommand
    Get-ItemProperty : Cannot find path 'HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\SBSMONITORING\Setup\' because it does not exist.
    At C:\windows\temp\Create-SBSMonitoringDb.ps1:35 char:23
    +     $key=get-itemproperty <<<<  "HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\SBSMONITORING\Setup\"
        + CategoryInfo          : ObjectNotFound: (HKLM:\SOFTWARE\...NITORING\Setup\:String) [Get-ItemProperty], ItemNotFo
       undException
        + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand
    Start-Service : Cannot find any service with service name 'MSSQL$SBSMONITORING'.
    At C:\windows\temp\Create-SBSMonitoringDb.ps1:54 char:14
    + Start-Service <<<<  'MSSQL$SBSMONITORING'
        + CategoryInfo          : ObjectNotFound: (MSSQL$SBSMONITORING:String) [Start-Service], ServiceCommandException
        + FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.StartServiceCommand
    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote
    connections..
    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not  allow
    remote connections..
    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote
    connections..
    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    WARNING: Waiting for service 'Windows SBS Manager (DataCollectorSvc)' to finish starting...
    <Ctrl-C>
    =================================================================
    If you have read this far and understand the above, what should I do next?

  • How to access the sql database in applet?

    How to access the sql database in applet?
    Please help me.

    import java.applet.*;
    import java.awl.*;
    import java.sql.*;
    //other packages
    public class jdb extends Applet
    Connection con;
    Statement stmt;
    String name="drvijay";
    String phoneno="9842088860";
    public void init(){}
    pubilc void stop(){}
    public void destroy(){}
    public void start()
    call();
    public void call()
    try{
              Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
              conn=DriverManager.getConnection("Jdbc:Odbc:emp","sa","");
              stmt=conn.createStatement();
              stmt.executeUpdate("insert into empdetails(name,phoneno) values ('"+name + "',''"+ phoneno +"' )" );
              }catch(SQLException e)
                   System.out.println("error"+e);
                   System.exit(0);
    //<applet code="jdb" height="200" width="200"> </applet>
    u this jdbc statement in any of the method..
    */

  • How to get the exact time when condition records has been created?

    Hello All,
    Can anyone thorw some light on - how to find the exact time on which a particular condition record has been created?
    I have tried to get it from KONP {by inputting condition record number}, but unfortunately time is not tracked over there, but the date is tracked.
    Await your valuable inputs on the same.
    Regards,
    Hrishi

    Dear Hrishi,
    Try with this
    Go to display mode of the condition record through VK13 transaction from the condition record overview screen go to menu Environment >Changes>Click on Change report now system will take you to the Change Documents for conditions selection screen here you input proper selection data then execute now system will give the all the details here you can find the time also.
    I hope this will help you,
    Regards,
    Murali.

  • How to share the same Database Connection when using several Task Flows ?

    Hi All,
    I’m using JDev 11.1.1.3.0.
    I’m developing ADF Fusion Applications (ABC BC, ADF Faces…)
    These applications are deployed on a Weblogic server.
    Each application has only one Application Module.
    All Application Modules have the same connection type defined: JDBC DataSource : jdbc/GCCDS
    It is working fine.
    I’ve also developed Task Flow Applications for small thinks that are reused in multiple main applications.
    Each Task Flow Application has also one Application Module with the same connections type as main applications.
    All these task flows are deployed to JAR file (ADF Library JAR File) and are reused on my main applications. (drag and drop from the Resource Palette to ADF Regions….).
    There are some parameters passed to Task Flows, so that they can filter data depending on which main applications they are called from.
    Everything is working perfectly.
    All my main applications are using more and more task flows. Which is nice for the reusability etc…?
    Only ONE PROBLEM: DATABASE CONNECTIONS.
    Every Task Flows service made a database connection. So one user may have 10 database connections for the same adf page. And when there are 100 users that are working at the same time, it becomes a problem.
    How to share the same database connections for the main applications and all task flows which are used in the main application?
    Best Regards
    Nicolas

    Hi John,
    When I open a ADF Library JAR file of one of my task flow. (gcc_tf_recentSites.jar)
    I can see TF_RecentSitesService.xml and TF_RecentSitesServiceImpl.class in gcc_tf_recentSites.jar\mu\gcc\tf\recentSites\model\service folder
    + bc4j.xcfg in gcc_tf_recentSites.jar\mu\gcc\tf\recentSites\model\service\common folder.
    bc4j.xcfg details are
    +<?xml version = '1.0' encoding = 'UTF-8'?>+
    +<BC4JConfig version="11.1" xmlns="http://xmlns.oracle.com/bc4j/configuration">+
    +<AppModuleConfigBag ApplicationName="mu.gcc.tf.recentSites.model.service.TF_RecentSitesService">+
    +<AppModuleConfig DeployPlatform="LOCAL" jbo.project="mu.gcc.tf.recentSites.model.TF_RecentSites_Model" name="TF_RecentSitesServiceLocal" ApplicationName="mu.gcc.tf.recentSites.model.service.TF_RecentSitesService">+
    +<Security AppModuleJndiName="mu.gcc.tf.recentSites.model.service.TF_RecentSitesService"/>+
    +<Custom JDBCDataSource="jdbc/GCCDS"/>+
    +</AppModuleConfig>+
    +<AppModuleConfig name="TF_RecentSitesServiceShared" ApplicationName="mu.gcc.tf.recentSites.model.service.TF_RecentSitesService" DeployPlatform="LOCAL" JDBCName="gccdev" jbo.project="mu.gcc.tf.recentSites.model.TF_RecentSites_Model">+
    +<AM-Pooling jbo.ampool.maxpoolsize="1" jbo.ampool.isuseexclusive="false"/>+
    +<Security AppModuleJndiName="mu.gcc.tf.recentSites.model.service.TF_RecentSitesService"/>+
    +</AppModuleConfig>+
    +</AppModuleConfigBag>+
    +</BC4JConfig>+
    So, it seems that the Application Module is packaged with the task flow....
    Is it normal ?
    Regards
    Nicolas

Maybe you are looking for

  • How can i upgrade to OSX Mountain Lion other than from the app store?

    I am trying to upgrade to OSX Mountain Lion from OSX Lion but i get this message: "We could not complete your purchase. The product distribution file could not be verified. It may be damaged or was not signed." Further I am able to download other pro

  • How to create new Database With existing Backup

    hi all my Scenario is i have full backup of my database(11g r2 64) i formatted my system and reinstall h3. Windows 7 ultimate 64 how to create the same Database as it was earliar? i have h3. Oracle 11g r2 same as backedUp 64 h3. Full Backup Through e

  • The start up display sticks at the silver apple

    My iPhone will not power off except by pressing round button and top button together. Thereafter it will not restart. Any ideas?

  • Ipod nano in recovery mode?

    Hi I recently purchased an ipod nano (3rd generation), I downloaded itunes onto my pc using windows XP, when I connected my ipod to my pc to transfer songs, itunes came up with the following message: "itunes has detected an ipod in recovery mode. You

  • About the adf Bindings object

    As far as I know, the page definition xml defines the datasource(such as the return method in the data control panel) of the .jspx page. when i intend to show the label text dynamically, i should use the Expression builder. then it popups a dialog wh