How do I create a mapping that - Allows a vehicle to have multiple parts - Allows a part to be in only one vehicle - Allows me to find the vehicle a part belongs to - Allows me to find all the parts in the vehicle

If possible, I'd like it all to be done with xdoclet tags. I looked at the Hibernate documentation but I can't see the forest from the trees.

Thanks,

L [ September 29, 2004: Message edited by: Laurent Duperval ]

Live Free, Live Happy

David Harkness

Ranch Hand

Posts: 1646

posted 12 years ago

Originally posted by Laurent Duperval: - Allows a vehicle to have multiple parts - Allows a part to be in only one vehicle

This describes a one-to-many relationship, yet you have modeled a many-to-many. It will work, but it may be more complicated than it needs to be.

If you don't get an answer, I would highly recommend you post your question on the XDoclet user mailing list. One of the main developers (and several other frequent posters) use XDoclet with Hibernate. I'm starting next week, so I can't help with it yet.

L Duperval

Ranch Hand

Posts: 63

posted 12 years ago

You know, after posting my message, I realized that the vehicle_parts table was propably overkill. Let me try to remove it to see what happens.

Thanks,

L

Live Free, Live Happy

pascal betz

Ranch Hand

Posts: 547

posted 12 years ago

hi

i wrote a tutorial on how to create hibernate mappings with xdoclet. you can find it here:tutorial

if you use the hibernate/xdoclet combo, then you do not need to write the DDL statements (create tables). an ant task will take care of that (if you want to).