Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Removing and entity with and @JoinTable(the child records are not removed...)
Removing and entity with and @JoinTable [message #643425] Mon, 06 December 2010 19:49 Go to next message
No real name is currently offline No real nameFriend
Messages: 4
Registered: November 2010
Junior Member
It appears that when we attempt to remove an entity the relationships within that entities @JoinTable are not removed.
The result is a SQL error that indicates that a "child record was found".

The confusing thing is that this code is fine in Hibernate. What is different in eclispselink?
With EclipseLink do children records have to explicitly be removed?
Did not see an annotation that would help...
Any input is appreciated.

Following is the code that attempts to remove the record and its children.

public void delete( RecipientPackageDeliveryPK id ) throws DataNotFoundException
RecipientPackageDelivery recipientPackageDelivery = entityManager.find( RecipientPackageDelivery.class, id );

entityManager.remove( recipientPackageDelivery );
recipientPackageDelivery = null;

Following is the entity envolved and the @JoinTable...

@Table( name = "CMM029" )
@Inheritance( strategy = InheritanceType.JOINED )
@DiscriminatorColumn( name = "DELIVERY_CHNL_ID", discriminatorType = DiscriminatorType.INTEGER )
public abstract class RecipientPackageDelivery implements Serializable

/** The documents. */
@JoinTable( name = "CMM031", joinColumns = { @JoinColumn( name = "PACKAGE_ID", referencedColumnName = "PACKAGE_ID" ),
@JoinColumn( name = "RECIPIENT_CDE", referencedColumnName = "RECIPIENT_CDE" ),
@JoinColumn( name = "DELIVERY_CHNL_ID", referencedColumnName = "DELIVERY_CHNL_ID" ) }, inverseJoinColumns = { @JoinColumn( name = "DOCUMENT_ID", referencedColumnName = "DOCUMENT_ID" ) } )
private List<Document> documents;



Re: Removing and entity with and @JoinTable [message #643910 is a reply to message #643425] Wed, 08 December 2010 16:44 Go to previous message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1288
Registered: July 2009
Senior Member

Can you try calling refresh after the find and see if that helps? Does the Document have a back references to RecipientPackageDelivery? Which version/build are you using?

Best Regards,
Previous Topic:JPQL statement: wrong generated SQL code?
Next Topic:problems setting javaagent in glassfish v3 with eclipselink 2.0
Goto Forum:

Current Time: Tue Mar 20 21:47:00 GMT 2018

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

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