openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From HÃ¥kon Sagehaug <hakon.sageh...@uni.no>
Subject Re: How to store a string array as a string array using jpa?
Date Fri, 08 Jul 2011 06:31:22 GMT
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 <suseendran_p@yahoo.com> 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.
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message