I am persisting with EclipseLink 1.1
I have 'apparently' successfully set up a m-t-m relationshiop between two entities as follows (orm.xml):
Tables are correct in the database. In fact the EntityManager loads correcty. And when running the persist method, everything works fine, no errors, but the join table data is not being written. The data belonging to both entities is successfully updated, but not its join information.
I tried modifying the Cascade properties for both of them as you can see, but still no luck.
I am pretty sure I am missing something but can't figure out what, since Eclipse is not giving any clue any more.
I would greatly appreciate your advise!
Many thanks in advance,
Make sure you are adding to both sides of the ManyToMany relationship. If you only add to one side, then your object model is not correct.
Only the side without the mapped-by is persisted, so if you are only adding to the other side, then nothing will be written to the database.
You are absolutely right!
Thanks! it worked at first run. I understand. If both collections are not reciprocally referenced the object model is incorrect, hence the persistence task won't fullfill. I find however strange that in that case no exception is thrown at all. In anycase I will bear that in mind for future ocasions.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com