Delete « Load « JPA Q&A





1. Delete item from collection in Hibernate without loading entities    stackoverflow.com

I have three tables:

user(id, name), 
group(id, name), 
xref_user_group(user_id, group_id)
I have Two java classes:
User {
    int id;
    String name;
}

Group {
    int id;
 ...

2. load() before delete() changes behavior    forum.hibernate.org

Using hibernate 3.6.0.Final I noticed that load()ing an object and delete()ing it behaves differently than just doing a delete(). The Session.delete() API doc states: Remove a persistent instance from the datastore. The argument may be an instance associated with the receiving Session or a transient instance with an identifier associated with existing persistent state. This operation cascades to associated instances if ...

3. Load, delete and then persist it    forum.hibernate.org

Hello everybody I have a parent child relation. I attached the .hbm.xml file at the end of this post. I have this relation persisted in the db. If I load the parent [obj = load(...)] from the db, then delete the parent [session.delete(parent)] , and then in another session I try to persist the same obj object in the db I ...

4. Load Objet before Delete Performance bottleneck    forum.hibernate.org

Hello, I am a bit stuck here. I have looked through the documentation but failed to find the answer to the following problem: I have a relationship between a parent object and two child objects. I want the child objects deleted from persistence when I delete the parent. This works fine except that Hibernate loads the child objects before it deletes ...

5. load() succeeds on delete()'d object if using proxy?    forum.hibernate.org

I'd appreciate any ideas on this... If I delete an object as follows: session.delete( facility ); session.flush(); //not sure if this is necessary? tx.commit(); then later attempt to load this object using: session.load( Facility.class, facilityID ); The deleted object is found and loaded, instead of throwing a ObjectNotFoundException. Note that this only happens if I specify a proxy for the Facility ...

6. Delete + load does not work as intended    forum.hibernate.org

I digged into the hibernate code and found the problem. It lies in the option allowProxyCreation (DefaultLoadListener.onLoad()). Using the load method, it seams to make it possible to use a proxy and only access the database if the proxy is accessed. Maybe this is a method of providing additional optimizations (loading more then one proxy but fetch all at once, once ...

7. "could not load an entity" Error on delete    forum.hibernate.org

8. Hibernate is running updates/deletes during a load operation    forum.hibernate.org

Hibernate version: 3.1 Mapping documents: main_sequence .... EMAIL_SEQ ...

9. Collection deleted and reinserted on load(Clazz.class, id)    forum.hibernate.org

Hello, I am finding a behaviour I do not understand and would appreciate some insight if possible. A Page has a collection of Asset. But in order to get additional attributes of the relationship it is modelled with a composite element. Therefore a Page has a collection of PageAsset, where PageAsset has an Asset and the additional properties. I am finding ...





10. Deleting without loading first?    forum.hibernate.org

Hi, I searched the documentation and the forum, but still couldn't find a clear answer - Can an object be deleted from the database without loading it first? The id of the object is known in advance, and it's a heavy and complicated object, so loading it just for deletion is inefficient. Thanks, Vitaliy

11. Hibernate load and delete    forum.hibernate.org

Hi, I'm bit stuck on this.In our company the hibernate domain object is send to the DAO with the id and the version, the object deletes, but this seems to be inconsistent at some points. What is the safe method. (1)Loading the object with the ID and deleting that in the DAO. or (2)Passing the domain object with the ID and ...

12. Hibernate deletes collection as soon as entity is loaded    forum.hibernate.org

Newbie Joined: Mon Apr 21, 2008 11:41 pm Posts: 6 Hi All, I have an entity with a map inside it. (Mapping to follow). In a web app I have been using the entity with no problems. I have recently added a new action that loads the entity, but in this action (and not the other action!) when I load the ...