Here's what I've seen (a slight addition to Fay's post in Nabble)

ElementCollection may be used with Collections, or Maps. It should not be
used with an array - like the original poster's example.

PersistentCollection is specific to OpenJPA and may be used with an array
(int[], String[]), or a Collection.

PersistentMap is also specific to OpenJPA and may be used with Maps.

-mike

2011/7/8 Håkon Sagehaug <[email protected]>

> Hi
>
> I use something like this
>
> @PersistentCollection
>    private List<String> subEntries = new LinkedList<String>();
>
> Can also be used for String arrays. I think that PersistentCollection is
> JPA
> specific, but there is a annotaion called ElementCollection, from the 2.0
> spec. See this thread[1] for more info
>
> [1]
>
> http://openjpa.208410.n2.nabble.com/ElementCollection-and-PersistentCollection-td4737753.html
>
>
>
> On 8 July 2011 07:33, Suseendran.P <[email protected]> wrote:
>
> > Thank you so much for ur reply..i go through the document..
> >
> > First i have to say i'm very new to JPA..,
> > i'm using javax.persistence related packages to annotate my class..means
> > not
> > using org.apache.openjpa.persistence related packages..in that document
> > they
> > gave JPA is not externalized can i mix these two packages in single
> class..
> >
> >  i constructed my class like this..
> >
> > @Entity
> > public class Station  {
> >
> >        @Id
> >        @GeneratedValue(strategy = GenerationType.AUTO)
> >        private long id;
> >
> >        private String[] names;
> >
> >        // setter and getter methods
> > }
> >
> > Now what annotation i ve to give to store this array of string names in
> > single row in Mysql database..
> >
> > --
> > View this message in context:
> >
> http://openjpa.208410.n2.nabble.com/How-to-store-a-string-array-as-a-string-array-using-jpa-tp209875p6561347.html
> > Sent from the OpenJPA Users mailing list archive at Nabble.com.
> >
>

Reply via email to