I have a Win. Form where new instances of one class are created and added to a collection. For create those instances I have to open another form were I pick from a list (loaded from DB with listXXXbyQuery()) an object that is related to it.
While I’m adding objects to the array I check the DB and all those objects are automatically persisted to the DB, even I haven’t make any transaction to save the object containing the collection.
I think it’s because Flush Mode is Auto. Is any way to change it to Commit? Perhaps this corrects this issue. (I didn’t enable cache for the classes). Later I try to evict the objects but nothing is changing.
I find that this Flush Mode can be selected when ORM code generation for Java is selected.
I have attached an image of one example of the problem. I need to create a Student who can have several addresses; each one has a description associated to it.
In a Form I create an Address and assign values to ZipCode and address. Also for selecting the Address_Type that is associated to it, I have to open a new Form with a Grid that fills by executing listAddress_TypeByQuery(null,null).
This address just created is added to an array (for later add each Address to Student.Address collection when the object Student is going to be saved).
Each time more than one new Address is created (with its Address _Type associated) those instance are added to the DB. If the FK_Student in Addresses is Nullable==false then an PersistentException is thrown.
In the coming version, we will support other options for flush mode (e.g. Commit) so that you can select not to generate as Auto, which is the cause of your current problem. I will inform you once the next version is out. If you want it now, I can arrange an early access release for you.
I am glad to inform you that VP Suite 3.1 has been released. Thanks to your suggestion, we now allow selecting flush mode in .NET ORM. Therefore, I would invite you download the latest version and have a try.