Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Problem with Cascade.REMOVE with OneToMany relationship JSE [FIXED](Cascading JSE)
Problem with Cascade.REMOVE with OneToMany relationship JSE [FIXED] [message #517324] Fri, 26 February 2010 22:43 Go to next message
Daniel Le Berre is currently offline Daniel Le BerreFriend
Messages: 82
Registered: July 2009
Member
Hi,

I am facing a strange issue.

I am using EclipseLink 2.0 in a web application running in JSE mode (Tomcat 6).

I have a hierarchy of entities (e.g. B extends A). B is in a OneToMany bidirectional relationship with class X.

I would like to remove elements X in relation with B when I remove B.

I set the cascade to Cascade.ALL.

If I deploy my entities in a JEE5 environment (Jonas 5.2 snapshot), it works fine.
(I mean I call the em.remove(a) in a stateless EJB)

If I deploy my entities on Tomcat 6, it does not seem to work.
(Here the em.remove(a) is performed in a regular Java class)

Is there something specific to setup to make cascading working in JSE environment?

[Updated on: Wed, 03 March 2010 07:06]

Report message to a moderator

Re: Problem with Cascade.REMOVE with OneToMany relationship JSE [message #518031 is a reply to message #517324] Tue, 02 March 2010 19:58 Go to previous messageGo to next message
James Sutherland is currently offline James SutherlandFriend
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

Cascading of remove should work the same in both.

Are you using JTA and a managed EntityManager is Jonas? It could be something different in the way the entity is managed, how do you create your EntityManager in Tomcat? Check the state of the entity before removing it, does it have the related objects in the 1-m collection?

Also check if any errors are occurring and enable logging to debug.


James : Wiki : Book : Blog : Twitter
Re: Problem with Cascade.REMOVE with OneToMany relationship JSE [message #518043 is a reply to message #518031] Tue, 02 March 2010 20:40 Go to previous messageGo to next message
Daniel Le Berre is currently offline Daniel Le BerreFriend
Messages: 82
Registered: July 2009
Member
Yes, in Jonas, I am in a real JEE5 container, using JTA.
I get the entity manager by direct injection using @PersistenceContext

With tomcat, I have to get a factory then to get the entity manager.
And I also have to manage the transactions "by hand".

I will check the state of the parent entity to make sure that all the children are visible at that point.

Thanks for your feedback.

Re: Problem with Cascade.REMOVE with OneToMany relationship JSE [message #518115 is a reply to message #518031] Wed, 03 March 2010 07:05 Go to previous message
Daniel Le Berre is currently offline Daniel Le BerreFriend
Messages: 82
Registered: July 2009
Member
The problem was indeed that the list of children was not properly filled at that point.

Thanks for your help!

Previous Topic:How to obtain connection from EntityManagerFactory?
Next Topic:Customization default sequence name.
Goto Forum:
  


Current Time: Fri Dec 19 21:54:16 GMT 2014

Powered by FUDForum. Page generated in 0.01792 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software