Skip to main content



      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 17:43 Go to next message
Eclipse UserFriend
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 02:06] by Moderator

Re: Problem with Cascade.REMOVE with OneToMany relationship JSE [message #518031 is a reply to message #517324] Tue, 02 March 2010 14:58 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: Problem with Cascade.REMOVE with OneToMany relationship JSE [message #518043 is a reply to message #518031] Tue, 02 March 2010 15:40 Go to previous messageGo to next message
Eclipse UserFriend
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 02:05 Go to previous message
Eclipse UserFriend
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: Wed Jul 23 23:48:33 EDT 2025

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

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

Back to the top