Java Mailing List Archive

http://www.gg3721.com/

Home » users.openjpa »

Re: @ElementCollection and @PersistentCollection

Fay Wang

2010-03-15

Replies: Find Java Web Hosting

Author LoginPost Reply
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 <jerry@(protected)>
To: users@(protected)
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-93721@(protected)
> To unsubscribe from OpenJPA Users, click here.
>


--
Sent from the OpenJPA Users mailing list archive at Nabble.com.



   

©2008 gg3721.com - Jax Systems, LLC, U.S.A.