Nhibernate Flush Mode

Hi I’m developing a simple application with C#.

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.

Thanks in advance for you help.

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.

Thanks in advance for you help.
Class_Diagram1.jpg
ERD1.jpg

Hello,

What did you do to trigger saving? By calling listXXX()?

Best regards,
Jick

Yes, exactly that. I use listXXbyquery to load an array and fill a grid.

Hi RAGM,

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.

Best regards,
Jick

Thanks for your response. It will be great to be able to enable the Commit flush mode for C# ORM. For me is really fundamental option in VP.

I’m looking forward for accessing to the new version.

Thanks Again.

Hi RAGM,

I already added your contact to my notification list. I will inform you once the next release is out.

Best regards,
Jick

Hi RAGM,

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.

Download page:
http://www.visual-paradigm.com/download/

Feel free to let me know if there are any questions. Enjoy!

Best regards,
Jick