After searching this forum, it appears that everyone suggest mapping two @ManyToOne mappings to an Entity object for the link table, but I also know in XML mapping before we could use a composite object instead like
Code:
<class name="Category" table="CATEGORY">
<set name="items" table="CATEGORY_ITEMS">
<key column="CATEGORY_ID"/>
<composite-element class="CategorizedItem">
<parent name="category"/>
<many-to-one name="item" class="Item"
column="ITEM_ID" not-null="true"/>
<property name="username" column="USERNAME" not-null="true"/>
<property name="dateAdded" column="DATE_ADDED" not-null="true"/>
</composite-element>
</set>
</class>
Is there an equivalent to that in Annotations, even if it is Hibernate Specific as opposed to JPA.
Thanks