Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] @EmbeeddedId vs @IdClass

Thanks Guy, it worked like a charm.  I did specify the @Column on each of the fields. Actually, I just copied the fields over from the entity but EclipseLink complained about the @Id on each field, so I simply removed it and kept the @Column to specify the field column names in the database. Of course I had to modify my finder methods on my facades to now use the PrimaryKey class to pass to the EntityManager.find() method, but I think that this is a cleaner approach.

Thanks again for the help...

Chris Mathrusse
christopher.mathrusse@xxxxxxxxxx



From: Guy Pelletier <guy.pelletier@xxxxxxxxxx>
To: "EclipseLink User Discussions" <eclipselink-users@xxxxxxxxxxx>
Date: 12/18/2009 05:32 AM
Subject: Re: [eclipselink-users] @EmbeeddedId vs @IdClass
Sent by: <eclipselink-users-bounces@xxxxxxxxxxx>





 
If you use an EmbeddedId, you are not required to specify the @Id or @Column on the pk fields, but you can if you want to map different values. If your Embeddable is shared you can use attribute overrides on the @EmbeddedId mapping.
 
Cheers,
Guy
----- Original Message -----
From: Christopher.Mathrusse@xxxxxxxxxx
To: Eclipselink-Users
Sent: Thursday, December 17, 2009 4:28 PM
Subject: [eclipselink-users] @EmbeeddedId vs @IdClass

Is there any preference in which one to use when it comes to composite Primary Keys? I can see from the documentation that I can use either or, but I'm wondering which one is preferable.

And if I decide to use the @Embeddable annotation on my PrimaryKey class, and @EmbeddedId in my entity,  do I need to annotate the Pk fields with @Column and @Id?


Thanks for the help...


Chris Mathrusse
christopher.mathrusse@xxxxxxxxxx


_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top