Reputation: 34064
I have the following pl/sql query,
INSERT INTO Table(ID,..................)
VALUES(SEQ.nextval,....................);
SELECT SEQ.currval ID FROM DUAL;
I need to get ID using hibernate. I am using the following query which showing error,
.....getDataSession().createSQLQuery(hQuery).list()
Any one help me.
Upvotes: 0
Views: 1556
Reputation: 18639
Create new Object and save it using session.save() method it will return this object id.
Object object = new Object();
//add object properties
object.setXXX(value);
//now save the object
String id =(String)getDataSession().save(object);
Hope it helps.
Upvotes: 1