据我所知,Persistent对象在DB中有表示,
但如果我在该对象上调用session.delete()
,
对象的状态是什么?
Detached or Transient ?
考虑以下代码:
Animal a = new Animal(1," Dolphin ", " Sea" );
Session s= SessionFactoryUtil.getSession();
Transaction tr = s.beginTransaction();
s.save(a);
s.flush(); //here a became persistent
s.delete(a);
tr.commit(); // what is the state of a here ?
s.close();