openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fay Wang <>
Subject Re: @ElementCollection and @PersistentCollection
Date Mon, 15 Mar 2010 17:10:50 GMT
As Jerry points out, ElementCollection is a standard JPA 2.0 annotation, while PersistentCollection
is OpenJPA-specific. Also, ElementCollection can be applied to Collection and Map for embeddables
or basic types, while PersistentCollection can only apply to Collection, for Map, you need
to use PersistentMap.


----- Original Message ----
From: No1UNo <>
Sent: Mon, March 15, 2010 9:10:33 AM
Subject: Re: @ElementCollection and @PersistentCollection

Sorry that I can't give you any definitive answer.  @ElementCollection is a JPA 2.0 element
which creates a collection of embedded entities.  The @PersistenceCollection element is older
and may be more general.

My general guideline is to prefer the standard annotations over package specific ones.  If
you are working with JPA 2.0 and are specifically using collections of embedded entities,
consider using @ElementCollection.  Otherwise, do what you've always done.

On Mar 15, 2010, at 11:42 AM, Jean-Baptiste BRIAUD -- Novlog [via OpenJPA] wrote:
> Hi 
> What are the differences between @ElementCollection and @PersistentCollection ? 
> I'm already using @PersistentCollection but I encountred @ElementCollection in the examples
folder of OpenJPA 2.0.0 beta 2 in a embedded folder. 
> At the end, I'm not sure to see a difference ... so I'm puzzled. 
> View message @

> To start a new topic under OpenJPA Users, email

> To unsubscribe from OpenJPA Users, click here.

View this message in context:
Sent from the OpenJPA Users mailing list archive at


View raw message