tags:

views:

15

answers:

2

hi can any body tell me how i can get the last in serted id in hibernate like in my sql i used the query like this:=="SELECT LAST_INSERT_ID()"

how i can represent this in hibernate

thanks in advance

A: 

Why you need this is unclear but it should be possible using a native query. Something like that:

Integer lastId = (Integer) session.createSQLQuery("SELECT LAST_INSERT_ID()")
    .uniqueResult();  
Pascal Thivent
A: 

thanks actually i got the solution inthis way

lSession.flush(); long lAddGUID = lObjAddressTable.getUserGUID(); pObjAddressDetails.setUserGUID(lAddGUID); if(0 != lAddGUID ){ lRetVal = true; }

but i have another doubt

can u tell me how i can update my data from a table with 2 where condition and i have no primary key even if the primary key is there i am not using that one thanks

Umakant