Hi_at_all,
scenario:
entity (name "attribute") with versioning support.
entity with a combined PK of an relationship_id and a version_id (and many other data fields).
I dont want the relationships to be dependent on the version of the entity. So I want to use ony one half of the combined Primary key.....
@ManyToMany
@JoinTable(
name="parent_child_attribute",
joinColumns=_at_JoinColumn(name="child_id", referencedColumnName="relationship_id"),
inverseJoinColumns=_at_JoinColumn(name="parent_id", referencedColumnName="relationship_id")
)
private List<Attribute> parentCategories = new ArrayList<Attribute>();
@ManyToMany(mappedBy = "parentCategories")
private List<Attribute> childCategories = new ArrayList<Attribute>();
But I get the error:
The @JoinColumns on the annotated element [private java.util.List com.spp.sdf.persistence.Attribute.parentCategories] from the entity class [class com.spp.sdf.persistence.Attribute] is incomplete. When the source entity class uses a composite primary key, a @JoinColumn must be specified for each join column using the @JoinColumns. Both the name and the referenceColumnName elements must be specified in each such @JoinColumn.
Do I have any chance to override this to get my very loose parent/children relationships without the version_id ?
or du I need to implement everything as native queries... ?
thank you in advance!
timo goetze
[Message sent by forum member 'timo18146' (timo18146)]
http://forums.java.net/jive/thread.jspa?messageID=245176