0 Replies Latest reply on Jan 1, 2009 11:26 AM by Daniel Tavares

    map atrribute

    Daniel Tavares Newbie

      Hello.

      i`m trying to map a attribute that is a Map using jpa annotation.


      With hibernate i map like this:

       <class name="User" table="user">
      ...
       <map name="rights" table="user_rights" lazy="false" cascade="all" order-by="entity_id asc" >
       <key column="user_id"/>
       <index column="entity_id" type="string"/>
       <element column="rights" type="string"/>
       </map>
      ....
       </class>
      


      it work!. but now i want use jpa annotations.

      how can i do it?
      i try it:

      @Entity
      public class User implements Serializable {
      ...
       @JoinTable(name = "user_rights",
       joinColumns = { @JoinColumn(name = "user_id") } )
       @MapKey(name="entity_id")
       private Map<String, String> rights;
      ...
      

      but it not work

      thanks!