users@glassfish.java.net

Re: CascadeType.PERSIST

From: Marina Vatkina <Marina.Vatkina_at_Sun.COM>
Date: Fri, 02 Nov 2007 11:51:50 -0700

Does it ignore your ids or throw an exception?

thanks,
-marina

Kenneth Clark wrote:
> If I manually set the id for the nested objects it works. Is this the
> correct way to do it?
>
>
>
>
>
> ________________
>
> Thanks and regards
>
>
>
> *Kenneth Clark*
>
> Solutions Engineer
>
>
>
> *Tel:** *27 11 679 3075
>
> *Mobile:** *27 (0) 84 583 1348**
>
> *Email:** *_kenneth.clark_at_skyetech.co.za
> <mailto:kenneth.clark_at_skyetech.co.za>_
>
> *Website:** *http://www.skyetech.co.za**
>
>
>
> *From:* Kenneth Clark [mailto:kenneth.clark_at_skyetech.co.za]
> *Sent:* 02 November 2007 15:19
> *To:* users_at_glassfish.dev.java.net
> *Subject:* CascadeType.PERSIST
>
>
>
> Hi all
>
>
>
> I have entity class that contain a @PrePersist method which sets the id
> of the object before sending it to the database.
>
>
>
> Now I have and object
>
> Public class ClientProfile{}
>
> Which contains a reference to a collection of type
>
> Public class Subscription{}
>
>
>
> But when I try and pass the object to the app server with the
> ClientProfile.SubscriptionCollection populated it does not want to
> create an id for the items inside the SubscriptionCollection even though
> the Subscription class defines the @PrePersist.
>
>
>
> Any Ideas on why? Do I have to manually set the id’s of the objects
> inside the collection?
>
>
>
> ________________
>
> Thanks and regards
>
>
>
> *Kenneth Clark*
>
> Solutions Engineer
>
>
>
> *Tel:** *27 11 679 3075
>
> *Mobile:** *27 (0) 84 583 1348**
>
> *Email:** *_kenneth.clark_at_skyetech.co.za
> <mailto:kenneth.clark_at_skyetech.co.za>_
>
> *Website:** *http://www.skyetech.co.za**
>
>
>
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.18/1104 - Release Date:
> 2007/11/01 18:47
>
>
>
> No virus found in this incoming message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.18/1104 - Release Date:
> 2007/11/01 18:47
>
>
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.503 / Virus Database: 269.15.18/1104 - Release Date:
> 2007/11/01 18:47
>