key « Delete « JPA Q&A





1. deleting by primary key    forum.hibernate.org

Is there a way in Hibernate to delete a row in the database without having to load the object's data into memory ? net.sf.hibernate.Session does not offer any method that deletes rows by primary key. I've noticed in the logs that even the method delete( String query ) first loads objects into memory, and then deletes them. Maybe I'm missing something, ...

2. delete object wonth only primary key    forum.hibernate.org

Why ther isn't a delete method like delete(Serializable pk) ? Where pk is a composite id o a primary key Now, if want delete a object, I should before load it e after delete. So Hibernate makes two (or more) sql istance. With my suggestion I can delete a object with this code: MyComposuteid pk= new MyComposuteid ("ABC22",2); session.delete(pk);

3. Session.delete where table has no primary keys    forum.hibernate.org

Newbie Joined: Tue Sep 14, 2004 11:33 pm Posts: 6 Hi there. I am working with a database that has no primary keys. This schema is beyond my control. As recommended I have configured the mappings to have logical keys, despite no keys existing. Where a table contains data that would break the key constraint (if it had one), the call ...