File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes calling sequences in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Object Relational Mapping
Reply Bookmark "calling sequences in hibernate" Watch "calling sequences in hibernate" New topic
Author

calling sequences in hibernate

Viswanath Sriram
Greenhorn

Joined: Jul 20, 2006
Posts: 12
Hi,

How to call sequences from hibernate.I want the sequence value.

(Removed E-mail so the user doesn't get tons more spam - Mark)
[ July 20, 2006: Message edited by: Mark Spritzler ]
pascal betz
Ranch Hand

Joined: Jun 19, 2001
Posts: 547
no. please do not email.
please use the forum to give an answer (or is your email account also indexed by the javaranch search ?)

cheers
pascal
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 16622

Well you have configured the ID to use the sequence already using generator set to sequence, then giving it the name of the sequence.

You can always write SQL to call a query like "select seq.currval from dual" and run it. or use nextval instead of currval.

Why do you need it, should you just let Hibernate when it calls insert to use the sequence, and then I believe after that you can get what was set into the Object.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
 
subject: calling sequences in hibernate
 
Threads others viewed
why my oracle sequence id increases by 2 when I use hibernate to insert
Business with or withouth MBA
char doubt
quotes that I want in arguments to main
sequence creation
developer file tools