Hi
I have two tables:
[Person]
id
name
adress
phone
[List]
id
l_name
I need to create by hibernate join table Lists where I can have FK.
[Lists]
id
fk_id_list
fk_id_person
for example:
[Person]
1 | Andy | St. Joan St. | +48 00 000000
2 | Mark | Uknow | +46 00 000000
[List]
1 | Default
2 | Secret
3 | Private
[Lists]
1 | 1 | 1
2 | 1 | 2
3 | 2 | 2
So on list Default I have 2 persons: Andy and Mark, on list Secret only Mark and so on.
How I have to map it in hbm.xml and put get-ters and set-ters in .java files to for example:
View who is on list Default, and if I delete list Default then all persons from list Default should be also deleted.
Is it many-to-one mapping?
thanks a lot for any help
mk
|