Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Hibernate, id, oracle, sequence

 
Bruno Frascino
Ranch Hand
Posts: 55
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Shailesh Kini
Ranch Hand
Posts: 153
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic