This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Object Relational Mapping and the fly likes Hibernate, id, oracle, sequence Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Hibernate, id, oracle, sequence" Watch "Hibernate, id, oracle, sequence" New topic
Author

Hibernate, id, oracle, sequence

Bruno Frascino
Ranch Hand

Joined: Jul 22, 2003
Posts: 55
Hello there,

My database is Oracle, and my id column value is an Oracle sequence, this sequence is executed by a trigger, so, before each row is inserted this trigger use this sequence to get the id value. So I am confused in which id strategy generation should I define in my entity class.

1 - native
2 - sequence (oracle sequence name, or let hibernate do it?)

Thanks


--BJCK--
Shailesh Kini
Ranch Hand

Joined: Oct 17, 2001
Posts: 153
Hello Bruno,

Here's something you could try. The id value is being inserted by the trigger for you so in my opinion you do not have to specify andy Generation strategy for your Id column. I suggest you set the updateable=false and insertable=false for the id column. You should be able to specify that either in the xml file or using @Column annotation.


Shailesh Kini.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Hibernate, id, oracle, sequence