-->
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.  [ 7 posts ] 
Author Message
 Post subject: Oracle sequence Nextval
PostPosted: Wed Oct 19, 2005 10:53 am 
Newbie

Joined: Wed Oct 19, 2005 10:44 am
Posts: 2
I need to know what's the easiest way to get the nextval from a sequence via Hibernate. This sequence is not for a primary key for an object.

I just need an integer returned when this sql is run - "select seq_name.nextval from dual"

Thanks


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 11:06 am 
Beginner
Beginner

Joined: Tue Nov 25, 2003 3:33 pm
Posts: 35
just create a sql query and run it.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 19, 2005 3:34 pm 
Newbie

Joined: Wed Oct 19, 2005 10:44 am
Posts: 2
Figured it out.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 3:20 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 2:21 am
Posts: 22
whether say

select OCCASION_ADDRESS_SEQ.nextval from dual holds good.
if so whether we need to write in this format
<sql-query>
...
..
</sql-query>

or is there any other way .

i'm a tyro to hibernate , i'm facing the same problem .
can u educate me in this .


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 3:21 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 2:21 am
Posts: 22
also i'm using spring + hibernate . so i will be using HibernateDAOSupport class .


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 05, 2005 9:50 pm 
Beginner
Beginner

Joined: Fri Oct 28, 2005 10:46 am
Posts: 37
Use getHibernateTemplate().execute and pass it a HibernateCallback. The HibernateCallback exposes a Hibernate Session to you, on which you can then call createSQLQuery. I'll leave it to you to figure out exactly how to use that method because I've never done so.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 24, 2005 2:35 pm 
Beginner
Beginner

Joined: Tue Jun 21, 2005 2:21 am
Posts: 22
thanks this is working


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 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.