Have you looked at this?
http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#entity-hibspec-collection

Also, I would recommend when you use annotations, use javax.persistence
always. You might be in trouble if you by mistake mix javax and hibernate
ones.

Josep


2010/9/21 jackalista <j...@twaxx.com>

>
> Hi,
>
> I am trying to map a List<String> in an entity object, and have tried to
> use
> both the  @org.hibernate.annotations.CollectionOfElements which is
> deprecated and the javax.persistence.ElementCollection (@ElementCollection)
> but I'm getting compilation errors on both of them saying that the class
> can't be resolved.  The property I'm trying to map is just a simple
> dependent collection, a List of Strings defined like this:
>
> private List<String> catalogIds;
>
> I tried mapping it like this but I'm getting an error saying that the
> javax.persistence.ElementCollection (and also CollectionTable) can't be
> resolved:
>
> @ElementCollection
>  @CollectionTable(
>        name="catalogs",
>        joincolum...@joincolumn(name="base_product_id")
>  )
>  @Column(name="catalog_id")
>  public List<String> getCatalogIds()
>  {
>    return catalogIds;
>  }
>
> The imports look like this:
>
> import javax.persistence.ElementCollection;
> import javax.persistence.CollectionTable;
> import javax.persistence.JoinColumn;
>
> This should be a simple thing but I can't find an example that works, can
> anyone help?  I'm using appfuse 2.1.0 M1 and it appears to be using
> hibernate 3.3 (there's a jar in WEB-INF/lib called
> "hibernate-core-3.3.1.GA.jar").  I'm assuming that since I found the
> @CollectionOfElements to be deprecated (it's a hibernate specific
> annotation) it's not the way to go but I tried both and got unresolved
> class
> exceptions from both.  Thanks...
> --
> View this message in context:
> http://appfuse.547863.n4.nabble.com/mapping-List-String-tp2549056p2549056.html
> Sent from the AppFuse - User mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@appfuse.dev.java.net
> For additional commands, e-mail: users-h...@appfuse.dev.java.net
>
>

Reply via email to