Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Beans > Toplink EJB and...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 3 Topic 1324 of 1363
Post > Topic >>

Toplink EJB and cascade persistence

by "tom.simmons@[EMAIL PROTECTED] " <tom.simmons@[EMAIL PROTECTED] > Sep 26, 2007 at 03:51 AM

I am using EJB3 and Toplink.

I have a parent entity and a child entity that is a one to many, the
child has the cascade=all defined, and the parent has a collection for
all the children that belong to it.

I can happily add children, and call either the create (persist) or
edit (merge) methods in the facades and the parent and children will
correctly be saved to the database, with the correct ID's in the
children pointing to the parent.

What I need to do though is be able to delete a child by saving the
parent if the child has been marked for deletion.

The system doesn't performing the deletes/adds as it goes, but instead
waits until the page is submitted.  So what I thought was when I save
the parent, I would be able to add something into create/edit methods
of the child facade class that would check a transient field and if it
said delete would instead call the remove method.

However by adding break points in the the three persistence methods of
the child facade, I can see that when calling the edit of the parent,
none of these methods are used.

Any ideas?
 




 3 Posts in Topic:
Toplink EJB and cascade persistence
"tom.simmons@[EMAIL   2007-09-26 03:51:28 
Re: Toplink EJB and cascade persistence
Torsten Jenkner <torst  2007-10-09 17:30:06 
Re: Toplink EJB and cascade persistence
Torsten Jenkner <torst  2007-10-09 17:31:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 5 14:51:01 CDT 2008.