-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: ID generation with Oracle insert trigger and sequence?
PostPosted: Mon Jan 26, 2004 5:47 am 
Newbie

Joined: Sat Jan 10, 2004 8:02 am
Posts: 15
Location: Munich, Germany
I am using Hibernate 2.1.1 with the Oracle 9i database.

What ID generation strategie do I have to set in the mapping file,
if I want to to use a

Oracle insert trigger for the primary key value generation of the pk column?

The Oracle insert trigger is fired every time, when a new record is inserted into
a table and fetches a new ID value from an Oracle sequence... (it's like a
AutoInc column in mySQL).

thx,
Juergen


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 6:02 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Well, you might be able to use the identity generator, if you write your custom dialect. Just override getIdentitySelectString to return a SQL query which fetches the last generated value from the database.

If that is not possible, try looking at writing your own generator class.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 6:16 am 
Newbie

Joined: Sat Jan 10, 2004 8:02 am
Posts: 15
Location: Munich, Germany
Thx, your proposals seem easy to be implemented, but I am wondering,
why hibernate doesn't support this commonly used strategy for Oracle?

The source must already be available in hibernate, so I will have a look
at the source for the mySQL autoinc id support.

=> What is the easiest way for me to extend hibernate and supply
the sources for the next release of hibernate?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Jan 26, 2004 6:23 am 
Hibernate Team
Hibernate Team

Joined: Tue Sep 09, 2003 2:10 pm
Posts: 3246
Location: Passau, Germany
Implement it, submit a request/patch to JIRA, get people to vote for it. I told you the possible ways to implement it allready.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.