-
1. Re: delete from non-owner relationship
javichi_fer Jun 6, 2008 7:51 PM (in response to ohad)Try:
candidate.getCandidateTests().remove(ct); em.remove(ct);
Regards
-
2. Re: delete from non-owner relationship
ohad Jun 6, 2008 9:54 PM (in response to ohad)I tried that.
(don't forget I'm in manuel flush mode)
I thought it should happen automaticly if I will use
em.merge(candidate) and that's what the candidateHome.update() shoudl do..anyhow if I'm calling em.remove(ct); before candidateHome.update();
I'm getting deleted entity passed to persist Exceptionany other idea?
btw , I'm using seam 2.0.2sp1 jboss 4.2.1 hibernate 3.2.6 RC3.2.1
-
3. Re: delete from non-owner relationship
javichi_fer Jun 6, 2008 10:07 PM (in response to ohad)To avoid the deleted entity exception limit the cascade to CascadeType.Persist
-
4. Re: delete from non-owner relationship
ohad Jun 6, 2008 10:12 PM (in response to ohad)Why?
I would my Merge to casecade..
when I update() Candidate I would like it to recognize that I removed 1 CandidateTest from candidate.getCandidateTests() and it should've been deleted... -
5. Re: delete from non-owner relationship
javichi_fer Jun 6, 2008 10:21 PM (in response to ohad)It will recognize that it has been deleted because you are deleting both from the collection and in the em:
candidate.getCandidateTests().remove(ct); em.remove(ct);
-
6. Re: delete from non-owner relationship
ohad Jun 7, 2008 12:43 AM (in response to ohad)well , it doesn't work , after I update() the Candidate I get an exception..
any other idea?
-
7. Re: delete from non-owner relationship
joaobmonteiro Jun 8, 2008 3:37 PM (in response to ohad)Please, post your exception message and maybe the stacktrace. I think this should work fine.
-
8. Re: delete from non-owner relationship
ohad Jun 8, 2008 3:45 PM (in response to ohad)I found the problem,
CandidateTest has also refrence to Test (Entity Bean)
I'd to remove the CandidateTest also from test.getCandidateTests()
and then I'd to use getEntityManager.remove(candidatetest) or using hibernate delete orphern cascade extention instead..thanks anyway