开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜