[jboss-user] [EJB 3.0] - map atrribute

DanielFT do-not-reply at jboss.com
Thu Jan 1 11:26:48 EST 2009


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!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4199118#4199118

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4199118



More information about the jboss-user mailing list