Hibernate version:3.2.5
I'm having trouble to map a list of values, bag with element.
This is the situation in DB:
t_actor: actor-id
t_actor_vs_roles :actor-id,role_id
t_roles: role_id,role_name
Now I want to map an ActorDTO which has a list of role. role is from an enum Role
I can't find a way, example of how to map this. I tried with a formula but that did not work:
<bag name="roles" lazy="false">
<key column="actor_code"/>
<element formula="SELECT r.role_name from T_ROLES r,T_ACTOR_VS_ROLE ar where ar.role_id = r.role_id and ar.actor_code = actor_code">
<type name="util.SimpleEnumUserType">
<param name="enumClassName">security.Role
</param>
</type>
</element>
</bag>
SimpleEnumUserType turns the string into a the enum.
I guess formula is not made to return multiple values.
An idea anyone?
Bart
|