Execute Insert and Select queries simultaneously from Hibernate
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 开发者_Python百科query which showing error,
.....getDataSession().createSQLQuery(hQuery).list()
Any one help me.
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.
精彩评论