you can add an PreUpdateEventListener and compare the cached and actual
object states to find the changes.

-Markus

2009/7/9 Cesar Sanz <[email protected]>

>  Hello markus and Thanx
>
>  using (new SessionScope(FlushAction.Never)) did works!
>
>
>  >Normally, if there is no change in the objects, nothing happens (the
> entities are not dirty).
>
> Normally?? Is there a chance that this happens without entities not been
> dirty?
>
> >If you experience flushing after a simple load, check whether your code
> changes anything in the entities.
>
> I followed my code and no changes are made. Is there a way to check if my
> entity is dirty? Can NHibernate shows me
> the changes...
>
> Thanx for answering
>
> ----- Original Message -----
>
> *From:* Markus Zywitza <[email protected]>
> *To:* [email protected]
> *Sent:* Thursday, July 09, 2009 12:02 AM
> *Subject:* Re: Why AR is Updating When Performing a Select
>
> When AR/NH loads entities, it puts them into a cache. When the
> session(scope) disposes, the objects in the cache are checked whether they
> have been changed and the changes are written back (flushed) to the DB.
>
> Normally, if there is no change in the objects, nothing happens (the
> entities are not dirty). If you experience flushing after a simple load,
> check whether your code changes anything in the entities.
>
> As a workaround, you can load your entities in a separate read-only
> sessionscope:
>
> using (new SessionScope(FlushAction.Never))
> {
>  // Load here
> }
> // Don't access lazy properties here!!!
>
> The downside is that you can't access lazy properties in your view
> templates.
> -Markus
>
> 2009/7/9 [email protected] <[email protected]>
>
>>
>> Hello..
>>
>> I am in a hurry cuz I have to release a small project.
>>
>> I use AR for this project, my model is simple,
>>
>> [Client] has many [Product]
>>
>> This is used in a web application, so a new session is opened on each
>> request.
>>
>> The point is.. when I perform a Client.FindAll() it select all the
>> clients (which is desirable) but at
>> the end of the request, I can see AR is updating each and every client
>> that found..
>>
>> I see no changes are really made.. So, I don't know what is happening
>> under the hood..
>>
>> I appreciate any kind of help.
>>
>> Best regards
>> >>
>>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to