Hi all,
I'm using hibernate 3.2.0.CR1 and annotations 3.1 beta 9. My problem is following:
I have a unidirectional many-to-many association between customers and roles (Customer class should have a method called getRoles()). The mapping table however also has an extra attribute expiryDate, that will tell when the specific role for the customer will expire (see the table definitions below). How can I do this by using annotations. I think the CollectionOfElements is the way to go, but have not found any examples for my specific problem.
I also think that I will need three different classes one for customer, one for the role and one for the customer_role mapping. Am I right or is there a way to do this without having a class for the customer_role?
Code:
tbl_customer
---------------
id
other fields
tbl_customer_role
---------------------
tbl_customer_id
tbl_role_id
expiry_date
tbl_role
--------------
id
other fields
Thanks,
Marika