[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2002) Setting the Primary Key when using Oracle

Garnet Miller (JIRA) noreply at atlassian.com
Mon Aug 14 13:47:18 EDT 2006


Setting the Primary Key when using Oracle
-----------------------------------------

         Key: HHH-2002
         URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-2002
     Project: Hibernate3
        Type: Bug

 Environment: Hibernate 3.0 on Oracle 10G 
    Reporter: Garnet Miller
    Priority: Blocker


The database is Oracle 10G, the primary keys are generated by firing a trigger which gets the next value from a sequence number generator and inserting this value into the primary key column.  The problem is that when we insert a record to a parent and an associated record into the child table at the same time I'm not able to have hibernate insert into the parent table and then use this value in the foriegn key of the child table.

A work around is to get the next value from the sequence generator manually using hibernate and then use this in the child tables foriegn key.  However this requires the trigger to be changed to accept a value for the primary key if one is given and if one is not given to fire the trigger and populate the primary key.  There are other applications using the database and this is not the preferred approach.

Any ideas on how to solve this?

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list