Hi Andrew,
i was faced with the same problem. A workaround would be to use the 
NHibernate.ByteCode.Castle instead of the built in ProxyFactory.
See this thread: 
https://groups.google.com/d/topic/nhibernate-development/sJmuqXvvSPU/discussion

Am Montag, 12. März 2012 19:19:31 UTC+1 schrieb Andrew B:
>
> I've got a pretty simple entity that has one lazy-loaded property (a 
> large string).  I want to change the values of two other properties on 
> the entity and save the changes to the database.  I don't need the 
> value of the lazy-loaded property at all for this process. 
>
> Unfortunately, NHibernate does not seem to issue an UPDATE statement. 
> If I set the property back to normal, non-lazy loading, the UPDATE is 
> issued correctly.  If I actually use the value of the lazy loaded 
> property before commiting, the UPDATE is issued correctly.  Is there 
> something I'm missing with the way lazy loaded properties work?  I'm 
> using NHibernate 3.2 and FluentNHibernate 1.3. 
>
> Class: 
> public class MyClass { 
>  public virtual int Id { get; set; } 
>  public virtual string BasicProperty { get; set; } 
>
>  public virtual string EmailContents { get; set; } 
>  public virtual OtherClass ReferencedItem { get; set; } 
>
>  public virtual void DoAction() { 
>   BasicProperty = "New value"; 
>  } 
> } 
>
> Mapping: 
> class FeedbackLoopEmailMapping : ClassMap<FeedbackLoopEmail> { 
>  public MyClassMapping() { 
>   Id(x => x.Id, "MyId").GeneratedBy.Identity(); 
>   Map(x => x.BasicProperty); 
>   Map(x => x.LazyLoadedProperty, "LLPDatabaseFieldName").LazyLoad(); 
>
>   References(x => x.ReferencedCollection, "ReferencedCollectionId"); 
>  } 
> } 
>
> The consuming code opens a session with a transaction, calls 
> 'DoAction' and then commits.  Thing is, I'm updating a property in an 
> unrelated entity and that change issues an UPDATE no matter what... 
>
> Thanks, 
> Andrew

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to