-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Check if removed detached object exists!?
PostPosted: Mon May 19, 2014 2:47 pm 
Newbie

Joined: Mon Sep 02, 2013 12:11 pm
Posts: 10
Hallo community,

I have a little problem.
I delete a parent-child reltaed entity using EntityManager.delete() and orphanremoval=true in my application.

Code:
   @OneToMany(fetch = FetchType.EAGER, mappedBy = "obj_ParentNode",orphanRemoval=true)
   private Set<ProjectDataTree> hs_ChildrenNodes = new HashSet<ProjectDataTree>(0);


This works perfect, all entities (including child) are deleted.
After that deleting a formerly-child entity in the same transaction throws an exception, that is correct.
The question is how can I check if an entity is deleted already to avoid throwing an exception? I´m using detach entities.

I tried
Code:
EntityManager.getReference()
EntityManager.getEntityManagerFactory().getPersistenceUnitUtil().isLoaded()
EntityManager.contains()


but nothing works.

Is there something like a list of removed entities?
Can anybody give me a hint to solve my problem?

Thanks in advance!!


Top
 Profile  
 
 Post subject: Re: Check if removed detached object exists!?
PostPosted: Mon May 19, 2014 7:36 pm 
Newbie

Joined: Sat May 17, 2014 1:26 pm
Posts: 2
EntityManager.find()


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.