Well, the following simple test works on 3.3.0CR1. In what ways do you
scenario differ?


[Test]
                public void CanUpdateNonLazyWithoutLoadingLazyProperty()
                {
                        Book book;
                        using (ISession s = OpenSession())
                        using (var trans = s.BeginTransaction())
                        {
                                book = s.Get<Book>(1);
                                book.Name += "updated";

                                
Assert.That(NHibernateUtil.IsPropertyInitialized(book,
"ALotOfText"), Is.False);
                                trans.Commit();
                        }


                        using (ISession s = OpenSession())
                        {
                                book = s.Get<Book>(1);
                                Assert.That(book.Name, Is.EqualTo("some 
nameupdated"));
                        }
                }


/Oskar


2012/3/12 Andrew B <[email protected]>:
> 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 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/nhusers?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" 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/nhusers?hl=en.

Reply via email to