Hey folks,
Figured out the problem as I wrote the post but it might help someone
of a similar brain dead persuasion.
I've set up a one-to-many relationship setup between my conversation and my message objects as follows
Code:
<set name="messages" table="CONVERSATION_MESSAGE" cascade="save-update,delete">
<key column="CONVERSATION_ID"/>
<many-to-many column="MESSAGE_ID"
unique="true"
lazy="false"
class="com.recorder.http.Message"/>
</set>
Now when I add a few messages to a conversation and save, everythings
grand.
I reload the conversation and remove a message from the set.
Now I update the conversation in the db. session.update( .... )
Now the row in the join table has been deleted by the message has not.
This means I could have a huge message table building up upbeknownst to me because they're orphaned.... Ahhh is that the answer??
Stickin' in the delete-orphan attribute... Loading.... Saving...
Deleting... checking table..... Hah it worked. Bingo bango.
That's champion.
Great app ye have here. If I can understand it anyone can.
Thanks,
Mark.