users@glassfish.java.net

RE: CascadeType.PERSIST

From: Kenneth Clark <kenneth.clark_at_skyetech.co.za>
Date: Fri, 2 Nov 2007 20:55:12 +0200

It just ignores the ID then throws an SQL exception because it is violating
the PK constraint by not adding the ID

________________
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
Website: http://www.skyetech.co.za


-----Original Message-----
From: Marina.Vatkina_at_Sun.COM [mailto:Marina.Vatkina_at_Sun.COM]
Sent: 02 November 2007 20:52
To: users_at_glassfish.dev.java.net
Subject: Re: CascadeType.PERSIST

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
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
For additional commands, e-mail: users-help_at_glassfish.dev.java.net

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