Thanks for the reply. I'm trying to do something like this:
Code:
@MapKey(name="name")
@Column(name="value")
@OneToMany(cascade={ CascadeType.ALL },
fetch=FetchType.EAGER)
@JoinTable(table=@Table(name="object_head_attrs"),
joinColumns={@JoinColumn(name="object_head_id",
referencedColumnName="object_head_id")})
public Map<String,String> getAttrs() {
return attrs;
}
public void setRoles(Map<String,String> attrs) {
this.attrs= attrs;
}
But I get the following exception:
Code:
org.hibernate.AnnotationException: Associated class not found: java.lang.String at
org.hibernate.cfg.annotations.MapBinder.bindKeyFromAssociationTable(MapBinder.java:58) at
org.hibernate.cfg.annotations.MapBinder.access$000(MapBinder.java:25) at
org.hibernate.cfg.annotations.MapBinder$1.secondPass(MapBinder.java:48) at
org.hibernate.cfg.CollectionSecondPass.doSecondPass(CollectionSecondPass.java:35) at
org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1023) at
org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:218) at
org.hibernate.cfg.Configuration.buildMappings(Configuration.java:988) at
org.hibernate.ejb.Ejb3Configuration.buildMappings(Ejb3Configuration.java:607) at
org.hibernate.ejb.EventListenerConfigurator.configure(EventListenerConfigurator.java:75) at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:473) at
org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:96) at
org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:142) ... 14 more
Anybody know what I am missing? How do I tell it (using annotations) that the value column is a plain old string?
Thanks for any help,
Mike