OK, I'll try to explain.
Imagine that you have Class C persisted in a database.
You also have Configuration, SessionFactory, Session, ClassMetadata etc.
The goal is to write a component which allows to edit set of instances of C:
Code:
for (int i)
{
if (classMetadata.getPropertyTypes()[i] == IntegerType)
ShowIntegerEditor(classMetadata.getPropertyValues()[i]);
//blah-blah-blah
if (classMetadata.getPropertyTypes()[i] == SetType)
ShowSetEditor(classMetadata.getPropertyValues()[i]);
}
In case of many-to-many relationship after editing the object with SetEditor I have to update all related objects. At present I have no idea how to do it.
There is a number of workarounds of how to do this.
1. I only allow to edit one side of association (where inverse=false). Thus user have no ability to edit or view another side so I have nothing to synchronize (let's suppose application that USES the data is another one)
This is what my first question was about.
2. I set both associations to have inverse=false and after changing any set always commit the transaction. This has two bad issues:
(i) I have to send extra data there and back again (this is what my second question was about)
(ii) I cannot rollback after I made a commit.
Heh?