[nhusers] Re: Kind of a novice question (Session.Save, Session.Flush, Transaction.Commit)

2009-08-24 Thread Andrey Shchekin (ashmind)

I haven't changed it, so it is the default mode in 2.1.
Without transaction it is not auto-flushed, with transaction it is
auto-flushed, but only for changes to existing entity.

(Sorry for the long delay, the question was approved when I already
was on a vacation).

On Aug 11, 10:58 pm, Davy Brion ral...@davybrion.com wrote:
 what's the FlushMode of the session?

 On Sun, Aug 9, 2009 at 3:43 PM, Andrey Shchekin (ashmind) ashm...@gmail.com



  wrote:

  I have a question about the way session.Save works.

  I have a session, I open a transaction over this session, and then
  commit the transaction.
  There are two different things I am doing within session and
  transaction:

  1. Load an entity and add another entity to one of its collections.
  This works and correctly persists all changes on commit.

  2. Create new entity and use Save to store it and get its key.
  This gives me a key, but does not persist the entity on commit.

  Now, if I call session.Flush in second case, it works -- but it does
  not seem to be a good practice.

  Is there something I am doing wrong?
  (btw is there a reason why disposing dirty session does not cause an
  exception? it seems to be an easy source of possible bugs)
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---



[nhusers] Re: Kind of a novice question (Session.Save, Session.Flush, Transaction.Commit)

2009-08-11 Thread Davy Brion
what's the FlushMode of the session?

On Sun, Aug 9, 2009 at 3:43 PM, Andrey Shchekin (ashmind) ashm...@gmail.com
 wrote:


 I have a question about the way session.Save works.

 I have a session, I open a transaction over this session, and then
 commit the transaction.
 There are two different things I am doing within session and
 transaction:

 1. Load an entity and add another entity to one of its collections.
 This works and correctly persists all changes on commit.

 2. Create new entity and use Save to store it and get its key.
 This gives me a key, but does not persist the entity on commit.

 Now, if I call session.Flush in second case, it works -- but it does
 not seem to be a good practice.

 Is there something I am doing wrong?
 (btw is there a reason why disposing dirty session does not cause an
 exception? it seems to be an easy source of possible bugs)

 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
nhusers group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~--~~~~--~~--~--~---