# Nhibernate Flush Mode

**URL:** <https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663>\
**Category:** General Questions/Discussions\
**Created:** [July 19, 2007, 4:44am UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663 "2007-07-19T04:44:44Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![RAGM](https://avatars.discourse-cdn.com/v2/letter/r/b3f665/32.png) [@RAGM](https://forums.visual-paradigm.com/u/RAGM)\
**Post date:** [July 19, 2007, 4:44am UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/1 "2007-07-19T04:44:44Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Anonymous](https://avatars.discourse-cdn.com/v2/letter/a/8491ac/32.png) [@Anonymous](https://forums.visual-paradigm.com/u/Anonymous)\
**Post date:** [July 19, 2007, 8:28am UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/2 "2007-07-19T08:28:01Z")

</div>

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.   
 ![](https://forums.visual-paradigm.com/uploads/default/original/2X/f/f3207ffdf59ae8457dfafe1c5d179cd38ed8b5a0.jpg)  
Class\_Diagram1.jpg   
 ![](https://forums.visual-paradigm.com/uploads/default/original/2X/3/3c92105eba3eee13641596c85a545fb77de3fe87.jpg)  
ERD1.jpg

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [July 19, 2007, 12:12pm UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/3 "2007-07-19T12:12:43Z")

</div>

Hello,

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

Best regards,  
Jick

---

<div class="post-metadata">

**Author:** ![RAGM](https://avatars.discourse-cdn.com/v2/letter/r/b3f665/32.png) [@RAGM](https://forums.visual-paradigm.com/u/RAGM)\
**Post date:** [July 19, 2007, 12:26pm UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/4 "2007-07-19T12:26:35Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [July 21, 2007, 5:27pm UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/5 "2007-07-21T17:27:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![RAGM](https://avatars.discourse-cdn.com/v2/letter/r/b3f665/32.png) [@RAGM](https://forums.visual-paradigm.com/u/RAGM)\
**Post date:** [July 23, 2007, 6:54am UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/6 "2007-07-23T06:54:40Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [July 25, 2007, 8:15pm UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/7 "2007-07-25T20:15:25Z")

</div>

Hi RAGM,

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

Best regards,  
Jick

---

<div class="post-metadata">

**Author:** ![Jick](https://avatars.discourse-cdn.com/v2/letter/j/ea666f/32.png) [@Jick](https://forums.visual-paradigm.com/u/Jick)\
**Post date:** [August 2, 2007, 4:14pm UTC](https://forums.visual-paradigm.com/t/nhibernate-flush-mode/9663/8 "2007-08-02T16:14:19Z")

</div>

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/](http://www.visual-paradigm.com/download/)

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

Best regards,  
Jick
