Regular |
|
Joined: Thu Jul 01, 2004 12:13 am Posts: 68 Location: San Diego, CA
|
I have a "many-to-many" relationship in my DBMS with an intermediary table that has the normal PK/FKs *and* additionally columns in it describing the relationship between the tables. What I did in Hibernate is map this as a one-to-many on each side of this intermediary table. An example would be something like Employee-Projects-Project.
Now say I want to save at the Employee level. On my Set in Employee I have cascade="save-update" as well as in project, but it also seems that I need to have cascade="save-update" on each <many-to-one...> in the Projects object to accommodate saving through the whole object graph from either direction, which sees to be a bit against the Hibernate convention (ie. it defaults to none).
I guess I am wondering what the best practice would be in this circumstance. It's nice to do just one save from either direction and have everything propagate, but I don't want to do that if I take a big performance hit or something worse.
Thanks,
Lou
|
|