Hi all,
I have a table that uses sequences (Oracle) in the
column id.
When I insert into database, I need to know this column id,
into session
Code:
Transaction tx = null;
Session session = null;
session = factory.openSession();
tx = session.beginTransaction();
// this object has an Id that
// uses sequence
obj1.setName("blablabla");
session.save(obj1, session);
// After, I need the Id of obj1, where I will use in another obj
obj2.setValue(1);
obj2.setAddress("St. 10");
obj2.setObj1(obj1);
session.save(obj2, session);
How can I know the last identification (obj1) inserted into database?
Thanks!!!!
[]