This content has been marked as final.
Show 7 replies
-
-
2. Re: Composite ID's
dornus Sep 19, 2005 1:11 PM (in response to weegeptr)Which is better and why? IdClass or EmbeddedId
-
3. Re: Composite ID's
epbernard Sep 19, 2005 1:18 PM (in response to weegeptr)This does not do the same thing, look at the doc.
-
4. Re: Composite ID's
dornus Sep 19, 2005 1:39 PM (in response to weegeptr)"epbernard" wrote:
This does not do the same thing, look at the doc.The IdClass annotation is used to denote a composite primary key. The EmbeddedId annotation is used to denote a composite primary key that is an embeddable class.
It's hard to tell from the docs. It looks like either can be used for composite keys, but if the composite key is comprised of foreign key(s) you have to use the embeddedId tag. If not, I do not understand what an embeddable class is.
Is this correct? -
5. Re: Composite ID's
epbernard Sep 21, 2005 6:05 AM (in response to weegeptr)@IdClass means the @Entity will have the pk properties in the class itself.
@EmbeddedId means the @Entity will have a composition link between itself and the @embeddable class. The embeddable class will have the pk properties. -
6. Re: Composite ID's
dornus Sep 21, 2005 8:19 AM (in response to weegeptr)"epbernard" wrote:
@IdClass means the @Entity will have the pk properties in the class itself.
@EmbeddedId means the @Entity will have a composition link between itself and the @embeddable class. The embeddable class will have the pk properties.
Does the @IdClass support composite primary keys made up of foreign keys any better than @EmbeddedId does? -