Neil的备忘录

just do it
posts - 66, comments - 8, trackbacks - 0, articles - 0

Deleting persistent objects

Posted on 2008-11-01 10:10 Neil's NoteBook 阅读(78) 评论(0)  编辑  收藏

Session.delete() will remove an object's state from the database. Of course, your application might still hold a reference to a deleted object. It's best to think of delete() as making a persistent instance transient.

sess.delete(cat);

You may delete objects in any order you like, without risk of foreign key constraint violations. It is still possible to violate a NOT NULL constraint on a foreign key column by deleting objects in the wrong order, e.g. if you delete the parent, but forget to delete the children. 


只有注册用户登录后才能发表评论。


网站导航: