I'm trying to map the followin classes:
public class Category implements java.io.Serializable {
@Id
@GeneratedValue
private Long id;
@OneToMany
@JoinColumn(name = "CATEGORY_ID")
@MapKey(name="language")
private Map<Language, CategoryDescription> description = new
HashMap<Language, CategoryDescription>();
...
}
public class Language implements java.io.Serializable {
@Id
@GeneratedValue
private Long id;
...
}
public class CategoryDescription implements java.io.Serializable {
@Id
@GeneratedValue
private Long id;
@ManyToOne(optional=false)
private Language language;
...
}
This worked for me using Hibernate and generated the following tables:
CATEGORY(ID,...)
LANGUAGE(ID,...)
CATEGORYDESCRIPTION(ID,LANGUAGE_ID,CATEGORY_ID,...)
Using OpenJPA I receive the following error:
<openjpa-1.1.0-r422266:657916 fatal user error>
org.apache.openjpa.persistence.ArgumentException: Map field
"at.idsoftware.vocabulary.data.Category.description" is attempting to use a
map table, but its key is mapped by another field. Use an inverse key or
join table mapping.
How to map this?
Thanks!
--
View this message in context:
http://n2.nabble.com/Map%3CClassA%2CClassB%3E-problem-tp534546p534546.html
Sent from the OpenJPA Users mailing list archive at Nabble.com.