Hi guys
I need your help on mapping a map of objects with compound id using annotations
This is how am trying to do it.
Code:
class A
{
...
@OneToMany()
@JoinColumn(name="A_ID")
/* B_ID should be the key in this map */
private Map<Long, B> map = new HashMap<Long, B>();
}
class B
{
@EmbeddedId
private CompoundId id;
}
@Embeddable
class CompoundId
{
@Column(name = "A_ID")
String aId;
@Column(name = "B_ID")
long bId
}
in mapping XML it looks like this
Code:
<map name="map" inverse="true" cascade="all-delete-orphan" lazy="false">
<key>
<column name="A_ID" />
</key>
<map-key type="long" column="B_ID"/>
<one-to-many class="B" />
</map>
I am using hibernate 3.2.7.ga and annotations 3.4.0.GA
thx