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.  [ 2 posts ] 
Author Message
 Post subject: Hibernate
PostPosted: Tue Jun 19, 2007 12:24 am 
Newbie

Joined: Tue Jun 19, 2007 12:11 am
Posts: 1
I'm using Hibernate version 3.0 and Oracle 9i.

I understand Hibernate can use XDoclet in the mapping files to use sequences to auto-generate values for fields but is there a way to deal with sequences directly with Hibernate?

Basically I want to have a method called "generateID()" which uses Hibernate to access the my ID_SEQ sequence in the database and return the value as a Long which I can then go on and use in my application. Is this possible?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 19, 2007 2:09 am 
Regular
Regular

Joined: Wed May 05, 2004 8:01 am
Posts: 53
First of all you no longer need to use XDoclet - java annotations are way better solution because they do not require any pre-compile steps to be performed.

There is no direct access to sequences used to generate IDs in hibernate itself. Still you can use direct JDBC access (on session.connection() or HibernateTemplate in spring framework dao) to do what you want.

Please rate if that helped.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.