Beginner |
|
Joined: Sat Oct 08, 2005 2:13 am Posts: 47
|
Hi
I am using Hibernate3
I have a table named "users" with columns :
Id_user int
username varchar
password varchar
the id_user is primary key and incremental, but there is another table named "roles"
I want to relation two table with column "username" but Hibernate use my primary key to join two table. how can I join two table with another column in a table, i dont want to join with primary key column.
my mapping in user.hbm.xml is:
.....
<set name="roles" lazy="false" inverse="false" table="role">
<key column="userName" />
<one-to-many class="com.project.conf.value.Role" />
</set>
.....
<there is a Set in class User>
hibernate use id_user to join table users with roles
pls help me....
thank u in advance
|
|