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.



Fay


----- Original Message ----
From: No1UNo <je...@jerrycarter.org>
To: users@openjpa.apache.org
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 @ 
> http://n2.nabble.com/ElementCollection-and-PersistentCollection-tp4737753p4737753.html
>  
> To start a new topic under OpenJPA Users, email 
> ml-node+208411-1595610943-93...@n2.nabble.com 
> To unsubscribe from OpenJPA Users, click here.
> 


-- 
View this message in context: 
http://n2.nabble.com/ElementCollection-and-PersistentCollection-tp4737753p4737969.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.



      

Reply via email to