I'm trying to port our current Hibernate/JPA annotations to Hibernate XML mappings and I've currently gotten stuck on the following relationship:
@ManyToMany(cascade = {CascadeType.PERSIST, CascadeType.MERGE, CascadeType.REFRESH }, fetch = FetchType.EAGER, targetEntity = Classifier.class) @IndexColumn(name = "list_index") @JoinTable(name = "product_classifiers", joinColumns = { @JoinColumn(name = "product_id") }, inverseJoinColumns = @JoinColumn(name = "classifier_id")) public List<Classifier> getClassifiers() { ...
These annotations will persist each Classifier's data and the data for the join table product_classifiers. However I have been unable to come up with the correct XML mapping for the above. I've tried the following but the data only cascades to the join table and not to Classifier's table:
<class name="Product" table="classifiers"> ... <list name="classifiers" table="product_classifiers" lazy="false" cascade="persist, merge, refresh"> <key column="product_id" not-null="true" /> <list-index column="list_index" /> <many-to-many class="Classifier" column="classifier_id" lazy="false"/> </list> ... </class> ... <class name="Classifier" table="classifiers"> <id name="id" column="id"/> <property name="typeId" column="typeId" /> <property name="description" column="description" /> </class>
Any help will be greatly appreciated. -- thx
|