[fluent-nhib] Re: Pascal Property <=> Underscore Field name

2009-01-26 Thread Ramana Kumar
Hi
For those who are interested in a PascalToUnderscore property conversion,
here is the solution.  BTW, thanks to Chris for the solution idea.

public class PascalToUnderscorePropertyConvention : IPropertyConvention
{
public bool CanHandle(IProperty propertyMapping)
  {
return true;
  }

  public void Process(IProperty propertyMapping)
  {
  propertyMapping.TheColumnNameIs(Inflector.Net.Inflector.Underscore(
propertyMapping.Property.Name));
return;
  }
}


Now to add the convention you need to do

AutoPersistenceModel mappings = AutoPersistenceModel
.MapEntitiesFromAssemblyOf()
.Where(GetAutoMappingFilter)
.WithConvention(convention =>
{
convention.AddPropertyConvention(new
PascalToUnderscorePropertyConvention());
// Other conventions...
});



On Sat, Jan 24, 2009 at 10:08 PM, Ramana Kumar wrote:

> Thanks a bunch for the solution.  I will try it out.
> Thanks
> Ramana
>
>
> On Sat, Jan 24, 2009 at 8:48 PM, Chris Marisic  wrote:
>
>>
>> I didn't test any of this code but it should be very similar to this,
>> I'd really check the boundary positions of my SubString as I
>> frequently get them wrong from just free coding. First I would create
>> an extension method for the string class
>>
>>public static class StringExtensions
>>{
>>/// 
>>/// Returns the Index the of next capital letter.
>>/// 
>>/// The value.
>>/// 
>>public static int IndexOfNextCapitalLetter(this string value)
>>{
>>return value.IndexOfNextCapitalLetter(1);
>>}
>>
>>/// 
>>/// Returns the Index the of next capital letter.
>>/// 
>>/// The value.
>>/// The start index.
>>/// 
>>public static int IndexOfNextCapitalLetter(this string value,
>> int startIndex)
>>{
>>return value.IndexOf(value.ToCharArray(startIndex,
>> value.Length).First(c => char.IsUpper(c)), startIndex, value.Length);
>>}
>>}
>>
>> This method will find the first capital letter inside the string after
>> the First letter so it would check FirstName and return 5 for 'N'. If
>> you have words that are like FirstMiddleLastName, you will need to
>> call this repeatedly to split the string over and over.
>>
>> Next is the custom property convention I would add to the
>> conventions.AddPropertyConvention() method.
>>
>>public class PropertyFromPascalCase : IPropertyConvention
>>{
>>
>>#region Implementation of IPropertyConvention
>>
>>public bool CanHandle(IProperty property)
>>{
>>//Might want to figure out some type of marker for the
>> properties?
>>return true;
>>}
>>
>>public void Process(IProperty propertyMapping)
>>{
>>string propertyName = propertyMapping.Property.Name;
>>int index = propertyName.IndexOfNextCapitalLetter();
>>
>>if (index >= 0)
>>propertyMapping.TheColumnNameIs(propertyName.Substring
>> (0, index) + "_" + propertyName.Substring(index, propertyName.Length -
>> index));
>>else
>>propertyMapping.TheColumnNameIs(propertyName);
>>}
>>
>>#endregion
>>}
>>
>> If you have complex names with multiple capital letters you could
>> change where it has just first half _  last half and change it to a
>> loop that it will find each index of the next capital letter and keep
>> building the string into First_Middle_Last_Name. Make sure you test
>> this convention out since it would always trigger for any property so
>> you might want to figure out some exemptions on the CanHandle method
>> if you have other property conventions and just make sure to include
>> the code to split the pascal case up into the other property
>> conventions also.
>>
>> On Jan 23, 8:00 pm, Ramana Kumar  wrote:
>> > Hi
>> > How would I implement a convention that translates from Pascal Property
>> > names to Underscore filed names column in the DB.
>> >
>> > Eg:
>> > FirstName <=> FIRST_NAME
>> > LastName <=> LAST_NAME
>> >
>> > etc.
>> >
>> > I will be using the Inflector.  However, I am not sure how to implement
>> the
>> > Convention in a fluent way.
>> > Thanks
>> > Ramana
>> >>
>>
>

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



[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
What relationship are you talking about Luis? One-to-many? Many-to-many?
Many-to-one?
On Mon, Jan 26, 2009 at 6:35 PM, Luis Abreu  wrote:

>
> Guys, pause please!
>
> Ok, I can see that adding the notlazyloaded method call will put lazy =
> false on my class on the generated xml. Now the problem is that when this
> xml is loaded I get exceptions saying that my properties aren't virtual
> (and
> no, they're not and no I don't want lazy lozading on myt class).
>
> Can anyone help and tell me why NH insist in using lazy when the lazy
> attribute on the class is set to false and the default-lazy attribute on
> the
> nhibernate element is set to true?
>
> Thanks.
>
> > -Original Message-
> > From: fluent-nhibernate@googlegroups.com [mailto:fluent-
> > nhibern...@googlegroups.com] On Behalf Of VisualHint
> > Sent: segunda-feira, 26 de Janeiro de 2009 15:58
> > To: Fluent NHibernate
> > Subject: [fluent-nhib] Re: Need some explanations about LazyLoad method
> >
> >
> > I understand a bit better now but note that:
> >
> > 1. When I generate the hbm from FNH and both LazyLoad and
> > NotLazyLoaded are not set on the class, then no lazy attribute is
> > added to the hbm file which maybe contradicts what you say ("Fluent
> > NHibernate always sets something")
> >
> > 2. If your explanation is right, LazyLoad() on the association is
> > absolutely of no use.
> >
> > N.
> >
> > On Jan 26, 10:23 am, James Gregory  wrote:
> > > That sounds correct to me. Whatever gets set on the class takes
> > precedence
> > > over what you set in the relationship.
> > > HBM allowed you to not set anything for lazy load, while Fluent
> > NHibernate
> > > always sets something; there's no way not to specify a value. So the
> > lazy on
> > > the relationship is used when the entity doesn't have any kind of
> > lazy
> > > setting, but if it does then it overrides whatever is set on the
> > > relationship; because FNH always sets a lazy value, it always
> > overrides the
> > > relationship.
> > >
> > > No bug here as far as I can tell, but the lazy on the references
> > method is
> > > perhaps redundant.
> > >
> > > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint 
> > wrote:
> > >
> > > > ok, so now that the default is lazy=true, I added NotLazyLoaded to
> > my
> > > > classmap. I set LazyLoad on my association only and again it is not
> > > > lazy loaded.
> > > > If however, I remove NotLazyLoaded, then the default takes
> > precedence
> > > > and with or without LazyLoad on my association, it is lazy loaded.
> > > > So I suspect something is wrong in the first case. The fault to NH
> > > > maybe (I'm with 2.1.0.1001).
> > >
> > > > N.
> > >
> > > > On Jan 26, 10:09 am, James Gregory  wrote:
> > > > > How are you getting your fluent mappings into nhibernate?
> > default-lazy
> > > > > should definitely be true if you're running on the latest trunk.
> > >
> > > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint 
> > wrote:
> > >
> > > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > > FluentNHibernate.MappingVisitor());
> > >
> > > > > > I get an hbm that has default-lazy=false and I can assure you
> > that I
> > > > > > got the latest FNH from the trunk, rebuilt it and referenced
> > it. The
> > > > > > various lazy settings are correctly added in the xml file for
> > the 2
> > > > > > versions of LazyLoad() methods.
> > > > > > I don't touch to the conventions.
> > > > > > Configuration is done through the hibernate.cfg.xml and it
> > contains
> > > > > > only the minimum:
> > >
> > > > > > 
> > > > > > 
> > > > > >  
> > > > > >Server=.
> > > > > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > > > > > > name="dialect">NHibernate.Dialect.MsSql2005Dialect > > > > > property>
> > > > > > > >
> > > >
> > name="connection.provider">NHibernate.Connection.DriverConnectionProvid
> > er > > > > > property>
> > > > > > > > > > >
> > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > > > property>
> > > > > >auto
> > > > > >500
> > >
> > > > > >true
> > > > > >true
> > >
> > > > > >  
> > > > > > 
> > >
> > > > > > On Jan 26, 9:45 am, James Gregory 
> > wrote:
> > > > > > > By default the "default-lazy" attribute is set to true on
> > every
> > > > mapping
> > > > > > > created by Fluent NHibernate, so unless you've overridden
> > this using
> > > > the
> > > > > > > conventions, that's what's getting set. As far as I
> > understand, this
> > > > > > infers
> > > > > > > the class level setting.
> > > > > > > How are you configuring your session factory? Could you write
> > out
> > > > your
> > > > > > > mappings using the WriteMappingsTo method of the
> > PersistenceModel,
> > > > then
> > > > > > we
> > > > > > > can see what's actually being generated.
> > >
> > > > > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint
> > 
> > > > wrote:
> > >
> > > > > > > > I use the latest FNH and it still doesn't work. I have to
> > > > explicitely
> > > > > > > > set LazyLoa

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread Luis Abreu

Guys, pause please!

Ok, I can see that adding the notlazyloaded method call will put lazy =
false on my class on the generated xml. Now the problem is that when this
xml is loaded I get exceptions saying that my properties aren't virtual (and
no, they're not and no I don't want lazy lozading on myt class). 

Can anyone help and tell me why NH insist in using lazy when the lazy
attribute on the class is set to false and the default-lazy attribute on the
nhibernate element is set to true?

Thanks.

> -Original Message-
> From: fluent-nhibernate@googlegroups.com [mailto:fluent-
> nhibern...@googlegroups.com] On Behalf Of VisualHint
> Sent: segunda-feira, 26 de Janeiro de 2009 15:58
> To: Fluent NHibernate
> Subject: [fluent-nhib] Re: Need some explanations about LazyLoad method
> 
> 
> I understand a bit better now but note that:
> 
> 1. When I generate the hbm from FNH and both LazyLoad and
> NotLazyLoaded are not set on the class, then no lazy attribute is
> added to the hbm file which maybe contradicts what you say ("Fluent
> NHibernate always sets something")
> 
> 2. If your explanation is right, LazyLoad() on the association is
> absolutely of no use.
> 
> N.
> 
> On Jan 26, 10:23 am, James Gregory  wrote:
> > That sounds correct to me. Whatever gets set on the class takes
> precedence
> > over what you set in the relationship.
> > HBM allowed you to not set anything for lazy load, while Fluent
> NHibernate
> > always sets something; there's no way not to specify a value. So the
> lazy on
> > the relationship is used when the entity doesn't have any kind of
> lazy
> > setting, but if it does then it overrides whatever is set on the
> > relationship; because FNH always sets a lazy value, it always
> overrides the
> > relationship.
> >
> > No bug here as far as I can tell, but the lazy on the references
> method is
> > perhaps redundant.
> >
> > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint 
> wrote:
> >
> > > ok, so now that the default is lazy=true, I added NotLazyLoaded to
> my
> > > classmap. I set LazyLoad on my association only and again it is not
> > > lazy loaded.
> > > If however, I remove NotLazyLoaded, then the default takes
> precedence
> > > and with or without LazyLoad on my association, it is lazy loaded.
> > > So I suspect something is wrong in the first case. The fault to NH
> > > maybe (I'm with 2.1.0.1001).
> >
> > > N.
> >
> > > On Jan 26, 10:09 am, James Gregory  wrote:
> > > > How are you getting your fluent mappings into nhibernate?
> default-lazy
> > > > should definitely be true if you're running on the latest trunk.
> >
> > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint 
> wrote:
> >
> > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > FluentNHibernate.MappingVisitor());
> >
> > > > > I get an hbm that has default-lazy=false and I can assure you
> that I
> > > > > got the latest FNH from the trunk, rebuilt it and referenced
> it. The
> > > > > various lazy settings are correctly added in the xml file for
> the 2
> > > > > versions of LazyLoad() methods.
> > > > > I don't touch to the conventions.
> > > > > Configuration is done through the hibernate.cfg.xml and it
> contains
> > > > > only the minimum:
> >
> > > > > 
> > > > > 
> > > > >  
> > > > >    Server=.
> > > > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > > > >     name="dialect">NHibernate.Dialect.MsSql2005Dialect > > > > property>
> > > > >     >
> > >
> name="connection.provider">NHibernate.Connection.DriverConnectionProvid
> er > > > > property>
> > > > >     > > > >
> name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > > property>
> > > > >    auto
> > > > >    500
> >
> > > > >    true
> > > > >    true
> >
> > > > >  
> > > > > 
> >
> > > > > On Jan 26, 9:45 am, James Gregory 
> wrote:
> > > > > > By default the "default-lazy" attribute is set to true on
> every
> > > mapping
> > > > > > created by Fluent NHibernate, so unless you've overridden
> this using
> > > the
> > > > > > conventions, that's what's getting set. As far as I
> understand, this
> > > > > infers
> > > > > > the class level setting.
> > > > > > How are you configuring your session factory? Could you write
> out
> > > your
> > > > > > mappings using the WriteMappingsTo method of the
> PersistenceModel,
> > > then
> > > > > we
> > > > > > can see what's actually being generated.
> >
> > > > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint
> 
> > > wrote:
> >
> > > > > > > I use the latest FNH and it still doesn't work. I have to
> > > explicitely
> > > > > > > set LazyLoad on the classmap to get this behavior.
> > > > > > > I understand the difference between the 2 lazyload methods
> but I
> > > don't
> > > > > > > understand when you say:
> >
> > > > > > > > however, the class gets precedence, so if your class
> isn't set
> > > > > > > > to lazy load (which was the default) then the references
> call
> > > won't
> > > > > have
> > > > > > > any
> > > > > > > > effect.
> >
> > > > > > >

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
Good point, I'll look into that.

On Mon, Jan 26, 2009 at 6:09 PM, VisualHint  wrote:

>
> Thanks for all James.
>
> I will just add that there is something missing in the FNH API. Since
> one have to set the class as LazyLoad to really get lazy loading
> working on an association, one also needs a way to invalidate the lazy
> loading on a single association, something like:
>
> References<...>().NotLazyLoaded()
>
> which would add the lazy="false" on the association (I tried it
> manually with a SetAttribute and it works well).
>
> On Jan 26, 12:53 pm, James Gregory  wrote:
> > In this case yes, because References/many-to-one isn't a collection;
> > NHibernate needs the properties to be virtual so it can create a proxy to
> > detect when something tries to access the referenced object, at which
> point
> > it can go fetch the actual data.
> >
> > On Mon, Jan 26, 2009 at 5:25 PM,  wrote:
> >
> > > So it's not possible to only lazy load associations/collections, the
> > > entire class has to be marked lazy load with every property set to
> > > virtual?
> >
> > > On Jan 26, 12:07 pm, James Gregory  wrote:
> > > > I don't think this is an issue, you just have to set lazy on the
> class;
> > > > that's just how it's done. If you don't set lazy on the class,
> NHibernate
> > > > has no way of lazy loading it as it won't know how to create the
> proxy.
> >
> > > > On Mon, Jan 26, 2009 at 4:54 PM, VisualHint 
> wrote:
> >
> > > > > And anyway, my first issue persists. I was able to reset
> default-lazy
> > > > > to false by using conventions. I don't put LazyLoad() on my class
> map
> > > > > and set it to my association only. I used WriteMappingsTo wo check
> > > > > that no lazy attribute is defined on the class and lazy="proxy" is
> > > > > defined on my association. With all that, my association is still
> > > > > eager loaded.
> >
> > > > > So would it be a NH issue instead of a FNH one ?
> >
> > > > > N.
> >
> > > > > On Jan 26, 10:57 am, VisualHint  wrote:
> > > > > > I understand a bit better now but note that:
> >
> > > > > > 1. When I generate the hbm from FNH and both LazyLoad and
> > > > > > NotLazyLoaded are not set on the class, then no lazy attribute is
> > > > > > added to the hbm file which maybe contradicts what you say
> ("Fluent
> > > > > > NHibernate always sets something")
> >
> > > > > > 2. If your explanation is right, LazyLoad() on the association is
> > > > > > absolutely of no use.
> >
> > > > > > N.
> >
> > > > > > On Jan 26, 10:23 am, James Gregory 
> wrote:
> >
> > > > > > > That sounds correct to me. Whatever gets set on the class takes
> > > > > precedence
> > > > > > > over what you set in the relationship.
> > > > > > > HBM allowed you to not set anything for lazy load, while Fluent
> > > > > NHibernate
> > > > > > > always sets something; there's no way not to specify a value.
> So
> > > the
> > > > > lazy on
> > > > > > > the relationship is used when the entity doesn't have any kind
> of
> > > lazy
> > > > > > > setting, but if it does then it overrides whatever is set on
> the
> > > > > > > relationship; because FNH always sets a lazy value, it always
> > > overrides
> > > > > the
> > > > > > > relationship.
> >
> > > > > > > No bug here as far as I can tell, but the lazy on the
> references
> > > method
> > > > > is
> > > > > > > perhaps redundant.
> >
> > > > > > > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint <
> cadil...@gmail.com>
> > > > > wrote:
> >
> > > > > > > > ok, so now that the default is lazy=true, I added
> NotLazyLoaded
> > > to my
> > > > > > > > classmap. I set LazyLoad on my association only and again it
> is
> > > not
> > > > > > > > lazy loaded.
> > > > > > > > If however, I remove NotLazyLoaded, then the default takes
> > > precedence
> > > > > > > > and with or without LazyLoad on my association, it is lazy
> > > loaded.
> > > > > > > > So I suspect something is wrong in the first case. The fault
> to
> > > NH
> > > > > > > > maybe (I'm with 2.1.0.1001).
> >
> > > > > > > > N.
> >
> > > > > > > > On Jan 26, 10:09 am, James Gregory 
> > > wrote:
> > > > > > > > > How are you getting your fluent mappings into nhibernate?
> > > > > default-lazy
> > > > > > > > > should definitely be true if you're running on the latest
> > > trunk.
> >
> > > > > > > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint <
> > > cadil...@gmail.com>
> > > > > wrote:
> >
> > > > > > > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > > > > > > FluentNHibernate.MappingVisitor());
> >
> > > > > > > > > > I get an hbm that has default-lazy=false and I can assure
> you
> > > > > that I
> > > > > > > > > > got the latest FNH from the trunk, rebuilt it and
> referenced
> > > it.
> > > > > The
> > > > > > > > > > various lazy settings are correctly added in the xml file
> for
> > > the
> > > > > 2
> > > > > > > > > > versions of LazyLoad() methods.
> > > > > > > > > > I don't touch to the conventions.
> > > > > > > > > > Configuration is done through the hibernate

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

Thanks for all James.

I will just add that there is something missing in the FNH API. Since
one have to set the class as LazyLoad to really get lazy loading
working on an association, one also needs a way to invalidate the lazy
loading on a single association, something like:

References<...>().NotLazyLoaded()

which would add the lazy="false" on the association (I tried it
manually with a SetAttribute and it works well).

On Jan 26, 12:53 pm, James Gregory  wrote:
> In this case yes, because References/many-to-one isn't a collection;
> NHibernate needs the properties to be virtual so it can create a proxy to
> detect when something tries to access the referenced object, at which point
> it can go fetch the actual data.
>
> On Mon, Jan 26, 2009 at 5:25 PM,  wrote:
>
> > So it's not possible to only lazy load associations/collections, the
> > entire class has to be marked lazy load with every property set to
> > virtual?
>
> > On Jan 26, 12:07 pm, James Gregory  wrote:
> > > I don't think this is an issue, you just have to set lazy on the class;
> > > that's just how it's done. If you don't set lazy on the class, NHibernate
> > > has no way of lazy loading it as it won't know how to create the proxy.
>
> > > On Mon, Jan 26, 2009 at 4:54 PM, VisualHint  wrote:
>
> > > > And anyway, my first issue persists. I was able to reset default-lazy
> > > > to false by using conventions. I don't put LazyLoad() on my class map
> > > > and set it to my association only. I used WriteMappingsTo wo check
> > > > that no lazy attribute is defined on the class and lazy="proxy" is
> > > > defined on my association. With all that, my association is still
> > > > eager loaded.
>
> > > > So would it be a NH issue instead of a FNH one ?
>
> > > > N.
>
> > > > On Jan 26, 10:57 am, VisualHint  wrote:
> > > > > I understand a bit better now but note that:
>
> > > > > 1. When I generate the hbm from FNH and both LazyLoad and
> > > > > NotLazyLoaded are not set on the class, then no lazy attribute is
> > > > > added to the hbm file which maybe contradicts what you say ("Fluent
> > > > > NHibernate always sets something")
>
> > > > > 2. If your explanation is right, LazyLoad() on the association is
> > > > > absolutely of no use.
>
> > > > > N.
>
> > > > > On Jan 26, 10:23 am, James Gregory  wrote:
>
> > > > > > That sounds correct to me. Whatever gets set on the class takes
> > > > precedence
> > > > > > over what you set in the relationship.
> > > > > > HBM allowed you to not set anything for lazy load, while Fluent
> > > > NHibernate
> > > > > > always sets something; there's no way not to specify a value. So
> > the
> > > > lazy on
> > > > > > the relationship is used when the entity doesn't have any kind of
> > lazy
> > > > > > setting, but if it does then it overrides whatever is set on the
> > > > > > relationship; because FNH always sets a lazy value, it always
> > overrides
> > > > the
> > > > > > relationship.
>
> > > > > > No bug here as far as I can tell, but the lazy on the references
> > method
> > > > is
> > > > > > perhaps redundant.
>
> > > > > > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint 
> > > > wrote:
>
> > > > > > > ok, so now that the default is lazy=true, I added NotLazyLoaded
> > to my
> > > > > > > classmap. I set LazyLoad on my association only and again it is
> > not
> > > > > > > lazy loaded.
> > > > > > > If however, I remove NotLazyLoaded, then the default takes
> > precedence
> > > > > > > and with or without LazyLoad on my association, it is lazy
> > loaded.
> > > > > > > So I suspect something is wrong in the first case. The fault to
> > NH
> > > > > > > maybe (I'm with 2.1.0.1001).
>
> > > > > > > N.
>
> > > > > > > On Jan 26, 10:09 am, James Gregory 
> > wrote:
> > > > > > > > How are you getting your fluent mappings into nhibernate?
> > > > default-lazy
> > > > > > > > should definitely be true if you're running on the latest
> > trunk.
>
> > > > > > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint <
> > cadil...@gmail.com>
> > > > wrote:
>
> > > > > > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > > > > > FluentNHibernate.MappingVisitor());
>
> > > > > > > > > I get an hbm that has default-lazy=false and I can assure you
> > > > that I
> > > > > > > > > got the latest FNH from the trunk, rebuilt it and referenced
> > it.
> > > > The
> > > > > > > > > various lazy settings are correctly added in the xml file for
> > the
> > > > 2
> > > > > > > > > versions of LazyLoad() methods.
> > > > > > > > > I don't touch to the conventions.
> > > > > > > > > Configuration is done through the hibernate.cfg.xml and it
> > > > contains
> > > > > > > > > only the minimum:
>
> > > > > > > > > 
> > > > > > > > >  > > > xmlns="urn:nhibernate-configuration-2.2">
> > > > > > > > >  
> > > > > > > > >    Server=.
> > > > > > > > > \SQLEXPRESS;Database=mydb;Integrated
> > Security=True;
> > > > > > > > >     > name="dialect">NHibernate.Dialect.MsSql2005Dialect > > > > > > > > property>
> > >

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
In this case yes, because References/many-to-one isn't a collection;
NHibernate needs the properties to be virtual so it can create a proxy to
detect when something tries to access the referenced object, at which point
it can go fetch the actual data.

On Mon, Jan 26, 2009 at 5:25 PM,  wrote:

>
> So it's not possible to only lazy load associations/collections, the
> entire class has to be marked lazy load with every property set to
> virtual?
>
> On Jan 26, 12:07 pm, James Gregory  wrote:
> > I don't think this is an issue, you just have to set lazy on the class;
> > that's just how it's done. If you don't set lazy on the class, NHibernate
> > has no way of lazy loading it as it won't know how to create the proxy.
> >
> > On Mon, Jan 26, 2009 at 4:54 PM, VisualHint  wrote:
> >
> > > And anyway, my first issue persists. I was able to reset default-lazy
> > > to false by using conventions. I don't put LazyLoad() on my class map
> > > and set it to my association only. I used WriteMappingsTo wo check
> > > that no lazy attribute is defined on the class and lazy="proxy" is
> > > defined on my association. With all that, my association is still
> > > eager loaded.
> >
> > > So would it be a NH issue instead of a FNH one ?
> >
> > > N.
> >
> > > On Jan 26, 10:57 am, VisualHint  wrote:
> > > > I understand a bit better now but note that:
> >
> > > > 1. When I generate the hbm from FNH and both LazyLoad and
> > > > NotLazyLoaded are not set on the class, then no lazy attribute is
> > > > added to the hbm file which maybe contradicts what you say ("Fluent
> > > > NHibernate always sets something")
> >
> > > > 2. If your explanation is right, LazyLoad() on the association is
> > > > absolutely of no use.
> >
> > > > N.
> >
> > > > On Jan 26, 10:23 am, James Gregory  wrote:
> >
> > > > > That sounds correct to me. Whatever gets set on the class takes
> > > precedence
> > > > > over what you set in the relationship.
> > > > > HBM allowed you to not set anything for lazy load, while Fluent
> > > NHibernate
> > > > > always sets something; there's no way not to specify a value. So
> the
> > > lazy on
> > > > > the relationship is used when the entity doesn't have any kind of
> lazy
> > > > > setting, but if it does then it overrides whatever is set on the
> > > > > relationship; because FNH always sets a lazy value, it always
> overrides
> > > the
> > > > > relationship.
> >
> > > > > No bug here as far as I can tell, but the lazy on the references
> method
> > > is
> > > > > perhaps redundant.
> >
> > > > > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint 
> > > wrote:
> >
> > > > > > ok, so now that the default is lazy=true, I added NotLazyLoaded
> to my
> > > > > > classmap. I set LazyLoad on my association only and again it is
> not
> > > > > > lazy loaded.
> > > > > > If however, I remove NotLazyLoaded, then the default takes
> precedence
> > > > > > and with or without LazyLoad on my association, it is lazy
> loaded.
> > > > > > So I suspect something is wrong in the first case. The fault to
> NH
> > > > > > maybe (I'm with 2.1.0.1001).
> >
> > > > > > N.
> >
> > > > > > On Jan 26, 10:09 am, James Gregory 
> wrote:
> > > > > > > How are you getting your fluent mappings into nhibernate?
> > > default-lazy
> > > > > > > should definitely be true if you're running on the latest
> trunk.
> >
> > > > > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint <
> cadil...@gmail.com>
> > > wrote:
> >
> > > > > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > > > > FluentNHibernate.MappingVisitor());
> >
> > > > > > > > I get an hbm that has default-lazy=false and I can assure you
> > > that I
> > > > > > > > got the latest FNH from the trunk, rebuilt it and referenced
> it.
> > > The
> > > > > > > > various lazy settings are correctly added in the xml file for
> the
> > > 2
> > > > > > > > versions of LazyLoad() methods.
> > > > > > > > I don't touch to the conventions.
> > > > > > > > Configuration is done through the hibernate.cfg.xml and it
> > > contains
> > > > > > > > only the minimum:
> >
> > > > > > > > 
> > > > > > > >  > > xmlns="urn:nhibernate-configuration-2.2">
> > > > > > > >  
> > > > > > > >Server=.
> > > > > > > > \SQLEXPRESS;Database=mydb;Integrated
> Security=True;
> > > > > > > > name="dialect">NHibernate.Dialect.MsSql2005Dialect > > > > > > > property>
> > > > > > > > >
> > >
> name="connection.provider">NHibernate.Connection.DriverConnectionProvider > > > > > > > property>
> > > > > > > > >
> > > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > > > > > property>
> > > > > > > >auto
> > > > > > > >500
> >
> > > > > > > >true
> > > > > > > >true
> >
> > > > > > > >  
> > > > > > > > 
> >
> > > > > > > > On Jan 26, 9:45 am, James Gregory 
> > > wrote:
> > > > > > > > > By default the "default-lazy" attribute is set to true on
> every
> > > > > > mapping
> > > > > > > > > created by Fluent NHibernate, so unless you've overridden
> this
> >

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread androidf58

So it's not possible to only lazy load associations/collections, the
entire class has to be marked lazy load with every property set to
virtual?

On Jan 26, 12:07 pm, James Gregory  wrote:
> I don't think this is an issue, you just have to set lazy on the class;
> that's just how it's done. If you don't set lazy on the class, NHibernate
> has no way of lazy loading it as it won't know how to create the proxy.
>
> On Mon, Jan 26, 2009 at 4:54 PM, VisualHint  wrote:
>
> > And anyway, my first issue persists. I was able to reset default-lazy
> > to false by using conventions. I don't put LazyLoad() on my class map
> > and set it to my association only. I used WriteMappingsTo wo check
> > that no lazy attribute is defined on the class and lazy="proxy" is
> > defined on my association. With all that, my association is still
> > eager loaded.
>
> > So would it be a NH issue instead of a FNH one ?
>
> > N.
>
> > On Jan 26, 10:57 am, VisualHint  wrote:
> > > I understand a bit better now but note that:
>
> > > 1. When I generate the hbm from FNH and both LazyLoad and
> > > NotLazyLoaded are not set on the class, then no lazy attribute is
> > > added to the hbm file which maybe contradicts what you say ("Fluent
> > > NHibernate always sets something")
>
> > > 2. If your explanation is right, LazyLoad() on the association is
> > > absolutely of no use.
>
> > > N.
>
> > > On Jan 26, 10:23 am, James Gregory  wrote:
>
> > > > That sounds correct to me. Whatever gets set on the class takes
> > precedence
> > > > over what you set in the relationship.
> > > > HBM allowed you to not set anything for lazy load, while Fluent
> > NHibernate
> > > > always sets something; there's no way not to specify a value. So the
> > lazy on
> > > > the relationship is used when the entity doesn't have any kind of lazy
> > > > setting, but if it does then it overrides whatever is set on the
> > > > relationship; because FNH always sets a lazy value, it always overrides
> > the
> > > > relationship.
>
> > > > No bug here as far as I can tell, but the lazy on the references method
> > is
> > > > perhaps redundant.
>
> > > > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint 
> > wrote:
>
> > > > > ok, so now that the default is lazy=true, I added NotLazyLoaded to my
> > > > > classmap. I set LazyLoad on my association only and again it is not
> > > > > lazy loaded.
> > > > > If however, I remove NotLazyLoaded, then the default takes precedence
> > > > > and with or without LazyLoad on my association, it is lazy loaded.
> > > > > So I suspect something is wrong in the first case. The fault to NH
> > > > > maybe (I'm with 2.1.0.1001).
>
> > > > > N.
>
> > > > > On Jan 26, 10:09 am, James Gregory  wrote:
> > > > > > How are you getting your fluent mappings into nhibernate?
> > default-lazy
> > > > > > should definitely be true if you're running on the latest trunk.
>
> > > > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint 
> > wrote:
>
> > > > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > > > FluentNHibernate.MappingVisitor());
>
> > > > > > > I get an hbm that has default-lazy=false and I can assure you
> > that I
> > > > > > > got the latest FNH from the trunk, rebuilt it and referenced it.
> > The
> > > > > > > various lazy settings are correctly added in the xml file for the
> > 2
> > > > > > > versions of LazyLoad() methods.
> > > > > > > I don't touch to the conventions.
> > > > > > > Configuration is done through the hibernate.cfg.xml and it
> > contains
> > > > > > > only the minimum:
>
> > > > > > > 
> > > > > > >  > xmlns="urn:nhibernate-configuration-2.2">
> > > > > > >  
> > > > > > >    Server=.
> > > > > > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > > > > > >    NHibernate.Dialect.MsSql2005Dialect > > > > > > property>
> > > > > > >    
> > name="connection.provider">NHibernate.Connection.DriverConnectionProvider > > > > > > property>
> > > > > > >    
> > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > > > > property>
> > > > > > >    auto
> > > > > > >    500
>
> > > > > > >    true
> > > > > > >    true
>
> > > > > > >  
> > > > > > > 
>
> > > > > > > On Jan 26, 9:45 am, James Gregory 
> > wrote:
> > > > > > > > By default the "default-lazy" attribute is set to true on every
> > > > > mapping
> > > > > > > > created by Fluent NHibernate, so unless you've overridden this
> > using
> > > > > the
> > > > > > > > conventions, that's what's getting set. As far as I understand,
> > this
> > > > > > > infers
> > > > > > > > the class level setting.
> > > > > > > > How are you configuring your session factory? Could you write
> > out
> > > > > your
> > > > > > > > mappings using the WriteMappingsTo method of the
> > PersistenceModel,
> > > > > then
> > > > > > > we
> > > > > > > > can see what's actually being generated.
>
> > > > > > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint <
> > cadil...@gmail.com>
> > > > > wrote:
>
> > > > > > > > > I use the latest FNH and it still 

[fluent-nhib] Re: Traversing a Description Class

2009-01-26 Thread James Gregory
Is this of any help:
http://blog.jagregory.com/2009/01/05/fluent-nhibernate-subclass-syntax-changes/

On Mon, Jan 26, 2009 at 5:01 PM,  wrote:

>
> Just starting out with Fluent so any help with this would be
> appreciated.
>
> Domain Entities:
> > Service {Abstract}
> > Storage : Service
> > ServiceDescription {Abstract}
> > UntimedServiceDescription : ServiceDescription
> Service aggregates ServiceDescription.
>
> DB Tables:
> > Service [FK ServiceDecriptionID int]
> > ServiceDescription [FK ServiceTypeID int]
> > ServiceType [IsTimed] [bit]
>
> I am having difficulty finding the correct subclass mapping code.
> From the above schema you will see that I need to
> DiscriminateSubClassesOnColumn("ServiceTypeID") in order to create the
> Storage subclass. I also need to DiscriminateSubClassesOnColumn
> ("IsTimed") in order to take into account that ServiceDescription can
> be of type UntimedServiceDescription or TimedServiceDescription.
>
> I suppose the entire question can be boiled down to how can you use
> DiscriminateSubClassesOnColumn() for tables and columns that are
> outside of the current ClassMap?
>
> Thanks
>
> Michael
>
>
>
>
>
>
>
> >
>

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



[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
I don't think this is an issue, you just have to set lazy on the class;
that's just how it's done. If you don't set lazy on the class, NHibernate
has no way of lazy loading it as it won't know how to create the proxy.

On Mon, Jan 26, 2009 at 4:54 PM, VisualHint  wrote:

>
> And anyway, my first issue persists. I was able to reset default-lazy
> to false by using conventions. I don't put LazyLoad() on my class map
> and set it to my association only. I used WriteMappingsTo wo check
> that no lazy attribute is defined on the class and lazy="proxy" is
> defined on my association. With all that, my association is still
> eager loaded.
>
> So would it be a NH issue instead of a FNH one ?
>
> N.
>
> On Jan 26, 10:57 am, VisualHint  wrote:
> > I understand a bit better now but note that:
> >
> > 1. When I generate the hbm from FNH and both LazyLoad and
> > NotLazyLoaded are not set on the class, then no lazy attribute is
> > added to the hbm file which maybe contradicts what you say ("Fluent
> > NHibernate always sets something")
> >
> > 2. If your explanation is right, LazyLoad() on the association is
> > absolutely of no use.
> >
> > N.
> >
> > On Jan 26, 10:23 am, James Gregory  wrote:
> >
> > > That sounds correct to me. Whatever gets set on the class takes
> precedence
> > > over what you set in the relationship.
> > > HBM allowed you to not set anything for lazy load, while Fluent
> NHibernate
> > > always sets something; there's no way not to specify a value. So the
> lazy on
> > > the relationship is used when the entity doesn't have any kind of lazy
> > > setting, but if it does then it overrides whatever is set on the
> > > relationship; because FNH always sets a lazy value, it always overrides
> the
> > > relationship.
> >
> > > No bug here as far as I can tell, but the lazy on the references method
> is
> > > perhaps redundant.
> >
> > > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint 
> wrote:
> >
> > > > ok, so now that the default is lazy=true, I added NotLazyLoaded to my
> > > > classmap. I set LazyLoad on my association only and again it is not
> > > > lazy loaded.
> > > > If however, I remove NotLazyLoaded, then the default takes precedence
> > > > and with or without LazyLoad on my association, it is lazy loaded.
> > > > So I suspect something is wrong in the first case. The fault to NH
> > > > maybe (I'm with 2.1.0.1001).
> >
> > > > N.
> >
> > > > On Jan 26, 10:09 am, James Gregory  wrote:
> > > > > How are you getting your fluent mappings into nhibernate?
> default-lazy
> > > > > should definitely be true if you're running on the latest trunk.
> >
> > > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint 
> wrote:
> >
> > > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > > FluentNHibernate.MappingVisitor());
> >
> > > > > > I get an hbm that has default-lazy=false and I can assure you
> that I
> > > > > > got the latest FNH from the trunk, rebuilt it and referenced it.
> The
> > > > > > various lazy settings are correctly added in the xml file for the
> 2
> > > > > > versions of LazyLoad() methods.
> > > > > > I don't touch to the conventions.
> > > > > > Configuration is done through the hibernate.cfg.xml and it
> contains
> > > > > > only the minimum:
> >
> > > > > > 
> > > > > >  xmlns="urn:nhibernate-configuration-2.2">
> > > > > >  
> > > > > >Server=.
> > > > > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > > > > >NHibernate.Dialect.MsSql2005Dialect > > > > > property>
> > > > > > >
> > > >
> name="connection.provider">NHibernate.Connection.DriverConnectionProvider > > > > > property>
> > > > > > > > > > >
> name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > > > property>
> > > > > >auto
> > > > > >500
> >
> > > > > >true
> > > > > >true
> >
> > > > > >  
> > > > > > 
> >
> > > > > > On Jan 26, 9:45 am, James Gregory 
> wrote:
> > > > > > > By default the "default-lazy" attribute is set to true on every
> > > > mapping
> > > > > > > created by Fluent NHibernate, so unless you've overridden this
> using
> > > > the
> > > > > > > conventions, that's what's getting set. As far as I understand,
> this
> > > > > > infers
> > > > > > > the class level setting.
> > > > > > > How are you configuring your session factory? Could you write
> out
> > > > your
> > > > > > > mappings using the WriteMappingsTo method of the
> PersistenceModel,
> > > > then
> > > > > > we
> > > > > > > can see what's actually being generated.
> >
> > > > > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint <
> cadil...@gmail.com>
> > > > wrote:
> >
> > > > > > > > I use the latest FNH and it still doesn't work. I have to
> > > > explicitely
> > > > > > > > set LazyLoad on the classmap to get this behavior.
> > > > > > > > I understand the difference between the 2 lazyload methods
> but I
> > > > don't
> > > > > > > > understand when you say:
> >
> > > > > > > > > however, the class gets precedence, so if your class isn't
> set
> > > > > > > 

[fluent-nhib] Re: Minor Typo in Wiki

2009-01-26 Thread James Gregory
You're correct. Fixed.

On Mon, Jan 26, 2009 at 4:55 PM, m4bwav  wrote:

>
> In the wiki example page:
> http://code.google.com/p/fluent-nhibernate/wiki/Examples,
> the last section is entitled "Entity spanning multiple classes", but
> the text below it indicates that the example should really be entitled
> "Entity spanning multiple tables".
>
> I could be wrong, but I doubt it.
> >
>

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



[fluent-nhib] Minor Typo in Wiki

2009-01-26 Thread m4bwav

In the wiki example page: 
http://code.google.com/p/fluent-nhibernate/wiki/Examples,
the last section is entitled "Entity spanning multiple classes", but
the text below it indicates that the example should really be entitled
"Entity spanning multiple tables".

I could be wrong, but I doubt it.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~--~~~~--~~--~--~---



[fluent-nhib] Traversing a Description Class

2009-01-26 Thread timeisfire8

Just starting out with Fluent so any help with this would be
appreciated.

Domain Entities:
> Service {Abstract}
> Storage : Service
> ServiceDescription {Abstract}
> UntimedServiceDescription : ServiceDescription
Service aggregates ServiceDescription.

DB Tables:
> Service [FK ServiceDecriptionID int]
> ServiceDescription [FK ServiceTypeID int]
> ServiceType [IsTimed] [bit]

I am having difficulty finding the correct subclass mapping code.
>From the above schema you will see that I need to
DiscriminateSubClassesOnColumn("ServiceTypeID") in order to create the
Storage subclass. I also need to DiscriminateSubClassesOnColumn
("IsTimed") in order to take into account that ServiceDescription can
be of type UntimedServiceDescription or TimedServiceDescription.

I suppose the entire question can be boiled down to how can you use
DiscriminateSubClassesOnColumn() for tables and columns that are
outside of the current ClassMap?

Thanks

Michael







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



[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

And anyway, my first issue persists. I was able to reset default-lazy
to false by using conventions. I don't put LazyLoad() on my class map
and set it to my association only. I used WriteMappingsTo wo check
that no lazy attribute is defined on the class and lazy="proxy" is
defined on my association. With all that, my association is still
eager loaded.

So would it be a NH issue instead of a FNH one ?

N.

On Jan 26, 10:57 am, VisualHint  wrote:
> I understand a bit better now but note that:
>
> 1. When I generate the hbm from FNH and both LazyLoad and
> NotLazyLoaded are not set on the class, then no lazy attribute is
> added to the hbm file which maybe contradicts what you say ("Fluent
> NHibernate always sets something")
>
> 2. If your explanation is right, LazyLoad() on the association is
> absolutely of no use.
>
> N.
>
> On Jan 26, 10:23 am, James Gregory  wrote:
>
> > That sounds correct to me. Whatever gets set on the class takes precedence
> > over what you set in the relationship.
> > HBM allowed you to not set anything for lazy load, while Fluent NHibernate
> > always sets something; there's no way not to specify a value. So the lazy on
> > the relationship is used when the entity doesn't have any kind of lazy
> > setting, but if it does then it overrides whatever is set on the
> > relationship; because FNH always sets a lazy value, it always overrides the
> > relationship.
>
> > No bug here as far as I can tell, but the lazy on the references method is
> > perhaps redundant.
>
> > On Mon, Jan 26, 2009 at 3:16 PM, VisualHint  wrote:
>
> > > ok, so now that the default is lazy=true, I added NotLazyLoaded to my
> > > classmap. I set LazyLoad on my association only and again it is not
> > > lazy loaded.
> > > If however, I remove NotLazyLoaded, then the default takes precedence
> > > and with or without LazyLoad on my association, it is lazy loaded.
> > > So I suspect something is wrong in the first case. The fault to NH
> > > maybe (I'm with 2.1.0.1001).
>
> > > N.
>
> > > On Jan 26, 10:09 am, James Gregory  wrote:
> > > > How are you getting your fluent mappings into nhibernate? default-lazy
> > > > should definitely be true if you're running on the latest trunk.
>
> > > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint  wrote:
>
> > > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > > FluentNHibernate.MappingVisitor());
>
> > > > > I get an hbm that has default-lazy=false and I can assure you that I
> > > > > got the latest FNH from the trunk, rebuilt it and referenced it. The
> > > > > various lazy settings are correctly added in the xml file for the 2
> > > > > versions of LazyLoad() methods.
> > > > > I don't touch to the conventions.
> > > > > Configuration is done through the hibernate.cfg.xml and it contains
> > > > > only the minimum:
>
> > > > > 
> > > > > 
> > > > >  
> > > > >    Server=.
> > > > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > > > >    NHibernate.Dialect.MsSql2005Dialect > > > > property>
> > > > >    
> > > name="connection.provider">NHibernate.Connection.DriverConnectionProvider > > > > property>
> > > > >     > > > > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > > property>
> > > > >    auto
> > > > >    500
>
> > > > >    true
> > > > >    true
>
> > > > >  
> > > > > 
>
> > > > > On Jan 26, 9:45 am, James Gregory  wrote:
> > > > > > By default the "default-lazy" attribute is set to true on every
> > > mapping
> > > > > > created by Fluent NHibernate, so unless you've overridden this using
> > > the
> > > > > > conventions, that's what's getting set. As far as I understand, this
> > > > > infers
> > > > > > the class level setting.
> > > > > > How are you configuring your session factory? Could you write out
> > > your
> > > > > > mappings using the WriteMappingsTo method of the PersistenceModel,
> > > then
> > > > > we
> > > > > > can see what's actually being generated.
>
> > > > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint 
> > > wrote:
>
> > > > > > > I use the latest FNH and it still doesn't work. I have to
> > > explicitely
> > > > > > > set LazyLoad on the classmap to get this behavior.
> > > > > > > I understand the difference between the 2 lazyload methods but I
> > > don't
> > > > > > > understand when you say:
>
> > > > > > > > however, the class gets precedence, so if your class isn't set
> > > > > > > > to lazy load (which was the default) then the references call
> > > won't
> > > > > have
> > > > > > > any
> > > > > > > > effect.
>
> > > > > > > Logically, if the entity is not forced to LazLoad then calling it
> > > or
> > > > > > > not on the association WOULD MAKE a difference.
> > > > > > > If you force it on the classmap then calling LazyLoad on the
> > > > > > > association would not change anything. If a NotLazyLoaded was
> > > possible
> > > > > > > on the association, then this one would make a difference. No?
>
> > > > > > > About trying with hbm, unfortunately, I tried to learn FNH befor

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

I understand a bit better now but note that:

1. When I generate the hbm from FNH and both LazyLoad and
NotLazyLoaded are not set on the class, then no lazy attribute is
added to the hbm file which maybe contradicts what you say ("Fluent
NHibernate always sets something")

2. If your explanation is right, LazyLoad() on the association is
absolutely of no use.

N.

On Jan 26, 10:23 am, James Gregory  wrote:
> That sounds correct to me. Whatever gets set on the class takes precedence
> over what you set in the relationship.
> HBM allowed you to not set anything for lazy load, while Fluent NHibernate
> always sets something; there's no way not to specify a value. So the lazy on
> the relationship is used when the entity doesn't have any kind of lazy
> setting, but if it does then it overrides whatever is set on the
> relationship; because FNH always sets a lazy value, it always overrides the
> relationship.
>
> No bug here as far as I can tell, but the lazy on the references method is
> perhaps redundant.
>
> On Mon, Jan 26, 2009 at 3:16 PM, VisualHint  wrote:
>
> > ok, so now that the default is lazy=true, I added NotLazyLoaded to my
> > classmap. I set LazyLoad on my association only and again it is not
> > lazy loaded.
> > If however, I remove NotLazyLoaded, then the default takes precedence
> > and with or without LazyLoad on my association, it is lazy loaded.
> > So I suspect something is wrong in the first case. The fault to NH
> > maybe (I'm with 2.1.0.1001).
>
> > N.
>
> > On Jan 26, 10:09 am, James Gregory  wrote:
> > > How are you getting your fluent mappings into nhibernate? default-lazy
> > > should definitely be true if you're running on the latest trunk.
>
> > > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint  wrote:
>
> > > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > > FluentNHibernate.MappingVisitor());
>
> > > > I get an hbm that has default-lazy=false and I can assure you that I
> > > > got the latest FNH from the trunk, rebuilt it and referenced it. The
> > > > various lazy settings are correctly added in the xml file for the 2
> > > > versions of LazyLoad() methods.
> > > > I don't touch to the conventions.
> > > > Configuration is done through the hibernate.cfg.xml and it contains
> > > > only the minimum:
>
> > > > 
> > > > 
> > > >  
> > > >    Server=.
> > > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > > >    NHibernate.Dialect.MsSql2005Dialect > > > property>
> > > >    
> > name="connection.provider">NHibernate.Connection.DriverConnectionProvider > > > property>
> > > >     > > > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > > property>
> > > >    auto
> > > >    500
>
> > > >    true
> > > >    true
>
> > > >  
> > > > 
>
> > > > On Jan 26, 9:45 am, James Gregory  wrote:
> > > > > By default the "default-lazy" attribute is set to true on every
> > mapping
> > > > > created by Fluent NHibernate, so unless you've overridden this using
> > the
> > > > > conventions, that's what's getting set. As far as I understand, this
> > > > infers
> > > > > the class level setting.
> > > > > How are you configuring your session factory? Could you write out
> > your
> > > > > mappings using the WriteMappingsTo method of the PersistenceModel,
> > then
> > > > we
> > > > > can see what's actually being generated.
>
> > > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint 
> > wrote:
>
> > > > > > I use the latest FNH and it still doesn't work. I have to
> > explicitely
> > > > > > set LazyLoad on the classmap to get this behavior.
> > > > > > I understand the difference between the 2 lazyload methods but I
> > don't
> > > > > > understand when you say:
>
> > > > > > > however, the class gets precedence, so if your class isn't set
> > > > > > > to lazy load (which was the default) then the references call
> > won't
> > > > have
> > > > > > any
> > > > > > > effect.
>
> > > > > > Logically, if the entity is not forced to LazLoad then calling it
> > or
> > > > > > not on the association WOULD MAKE a difference.
> > > > > > If you force it on the classmap then calling LazyLoad on the
> > > > > > association would not change anything. If a NotLazyLoaded was
> > possible
> > > > > > on the association, then this one would make a difference. No?
>
> > > > > > About trying with hbm, unfortunately, I tried to learn FNH before
> > HBM
> > > > > > so this is not something I can immediately try.
>
> > > > > > N.
>
> > > > > > On Jan 26, 7:14 am, James Gregory  wrote:
> > > > > > > @Nicolas: How old is your copy of Fluent NHibernate? Originally
> > it
> > > > was
> > > > > > the
> > > > > > > default that all entities would be not lazy loaded; so if your
> > copy
> > > > is
> > > > > > from
> > > > > > > then, you won't see the lazy load behaviour.
> > > > > > > The two different lazy load methods you spoke of do different
> > things,
> > > > the
> > > > > > > lazy load on the class sets it at the entity level, so whenever
> > that
> > > > > > entity
> > > > > > 

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
That sounds correct to me. Whatever gets set on the class takes precedence
over what you set in the relationship.
HBM allowed you to not set anything for lazy load, while Fluent NHibernate
always sets something; there's no way not to specify a value. So the lazy on
the relationship is used when the entity doesn't have any kind of lazy
setting, but if it does then it overrides whatever is set on the
relationship; because FNH always sets a lazy value, it always overrides the
relationship.

No bug here as far as I can tell, but the lazy on the references method is
perhaps redundant.

On Mon, Jan 26, 2009 at 3:16 PM, VisualHint  wrote:

>
> ok, so now that the default is lazy=true, I added NotLazyLoaded to my
> classmap. I set LazyLoad on my association only and again it is not
> lazy loaded.
> If however, I remove NotLazyLoaded, then the default takes precedence
> and with or without LazyLoad on my association, it is lazy loaded.
> So I suspect something is wrong in the first case. The fault to NH
> maybe (I'm with 2.1.0.1001).
>
> N.
>
>
> On Jan 26, 10:09 am, James Gregory  wrote:
> > How are you getting your fluent mappings into nhibernate? default-lazy
> > should definitely be true if you're running on the latest trunk.
> >
> > On Mon, Jan 26, 2009 at 2:54 PM, VisualHint  wrote:
> >
> > > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > > FluentNHibernate.MappingVisitor());
> >
> > > I get an hbm that has default-lazy=false and I can assure you that I
> > > got the latest FNH from the trunk, rebuilt it and referenced it. The
> > > various lazy settings are correctly added in the xml file for the 2
> > > versions of LazyLoad() methods.
> > > I don't touch to the conventions.
> > > Configuration is done through the hibernate.cfg.xml and it contains
> > > only the minimum:
> >
> > > 
> > > 
> > >  
> > >Server=.
> > > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> > >NHibernate.Dialect.MsSql2005Dialect > > property>
> > > > >
> name="connection.provider">NHibernate.Connection.DriverConnectionProvider > > property>
> > > > > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > > property>
> > >auto
> > >500
> >
> > >true
> > >true
> >
> > >  
> > > 
> >
> > > On Jan 26, 9:45 am, James Gregory  wrote:
> > > > By default the "default-lazy" attribute is set to true on every
> mapping
> > > > created by Fluent NHibernate, so unless you've overridden this using
> the
> > > > conventions, that's what's getting set. As far as I understand, this
> > > infers
> > > > the class level setting.
> > > > How are you configuring your session factory? Could you write out
> your
> > > > mappings using the WriteMappingsTo method of the PersistenceModel,
> then
> > > we
> > > > can see what's actually being generated.
> >
> > > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint 
> wrote:
> >
> > > > > I use the latest FNH and it still doesn't work. I have to
> explicitely
> > > > > set LazyLoad on the classmap to get this behavior.
> > > > > I understand the difference between the 2 lazyload methods but I
> don't
> > > > > understand when you say:
> >
> > > > > > however, the class gets precedence, so if your class isn't set
> > > > > > to lazy load (which was the default) then the references call
> won't
> > > have
> > > > > any
> > > > > > effect.
> >
> > > > > Logically, if the entity is not forced to LazLoad then calling it
> or
> > > > > not on the association WOULD MAKE a difference.
> > > > > If you force it on the classmap then calling LazyLoad on the
> > > > > association would not change anything. If a NotLazyLoaded was
> possible
> > > > > on the association, then this one would make a difference. No?
> >
> > > > > About trying with hbm, unfortunately, I tried to learn FNH before
> HBM
> > > > > so this is not something I can immediately try.
> >
> > > > > N.
> >
> > > > > On Jan 26, 7:14 am, James Gregory  wrote:
> > > > > > @Nicolas: How old is your copy of Fluent NHibernate? Originally
> it
> > > was
> > > > > the
> > > > > > default that all entities would be not lazy loaded; so if your
> copy
> > > is
> > > > > from
> > > > > > then, you won't see the lazy load behaviour.
> > > > > > The two different lazy load methods you spoke of do different
> things,
> > > the
> > > > > > lazy load on the class sets it at the entity level, so whenever
> that
> > > > > entity
> > > > > > is referenced anywhere it's lazy loaded, the other sets it for
> that
> > > > > specific
> > > > > > relationship; however, the class gets precedence, so if your
> class
> > > isn't
> > > > > set
> > > > > > to lazy load (which was the default) then the references call
> won't
> > > have
> > > > > any
> > > > > > effect.
> >
> > > > > > As Seb said, the reason the class lazy load requires virtual
> methods
> > > is
> > > > > > because it creates a proxy of the entity. If your methods aren't
> > > already
> > > > > > virtual, then your lazy loading won't be working because
> NHibernat

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

ok, so now that the default is lazy=true, I added NotLazyLoaded to my
classmap. I set LazyLoad on my association only and again it is not
lazy loaded.
If however, I remove NotLazyLoaded, then the default takes precedence
and with or without LazyLoad on my association, it is lazy loaded.
So I suspect something is wrong in the first case. The fault to NH
maybe (I'm with 2.1.0.1001).

N.


On Jan 26, 10:09 am, James Gregory  wrote:
> How are you getting your fluent mappings into nhibernate? default-lazy
> should definitely be true if you're running on the latest trunk.
>
> On Mon, Jan 26, 2009 at 2:54 PM, VisualHint  wrote:
>
> > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > FluentNHibernate.MappingVisitor());
>
> > I get an hbm that has default-lazy=false and I can assure you that I
> > got the latest FNH from the trunk, rebuilt it and referenced it. The
> > various lazy settings are correctly added in the xml file for the 2
> > versions of LazyLoad() methods.
> > I don't touch to the conventions.
> > Configuration is done through the hibernate.cfg.xml and it contains
> > only the minimum:
>
> > 
> > 
> >  
> >    Server=.
> > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> >    NHibernate.Dialect.MsSql2005Dialect > property>
> >     > name="connection.provider">NHibernate.Connection.DriverConnectionProvider > property>
> >     > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > property>
> >    auto
> >    500
>
> >    true
> >    true
>
> >  
> > 
>
> > On Jan 26, 9:45 am, James Gregory  wrote:
> > > By default the "default-lazy" attribute is set to true on every mapping
> > > created by Fluent NHibernate, so unless you've overridden this using the
> > > conventions, that's what's getting set. As far as I understand, this
> > infers
> > > the class level setting.
> > > How are you configuring your session factory? Could you write out your
> > > mappings using the WriteMappingsTo method of the PersistenceModel, then
> > we
> > > can see what's actually being generated.
>
> > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint  wrote:
>
> > > > I use the latest FNH and it still doesn't work. I have to explicitely
> > > > set LazyLoad on the classmap to get this behavior.
> > > > I understand the difference between the 2 lazyload methods but I don't
> > > > understand when you say:
>
> > > > > however, the class gets precedence, so if your class isn't set
> > > > > to lazy load (which was the default) then the references call won't
> > have
> > > > any
> > > > > effect.
>
> > > > Logically, if the entity is not forced to LazLoad then calling it or
> > > > not on the association WOULD MAKE a difference.
> > > > If you force it on the classmap then calling LazyLoad on the
> > > > association would not change anything. If a NotLazyLoaded was possible
> > > > on the association, then this one would make a difference. No?
>
> > > > About trying with hbm, unfortunately, I tried to learn FNH before HBM
> > > > so this is not something I can immediately try.
>
> > > > N.
>
> > > > On Jan 26, 7:14 am, James Gregory  wrote:
> > > > > @Nicolas: How old is your copy of Fluent NHibernate? Originally it
> > was
> > > > the
> > > > > default that all entities would be not lazy loaded; so if your copy
> > is
> > > > from
> > > > > then, you won't see the lazy load behaviour.
> > > > > The two different lazy load methods you spoke of do different things,
> > the
> > > > > lazy load on the class sets it at the entity level, so whenever that
> > > > entity
> > > > > is referenced anywhere it's lazy loaded, the other sets it for that
> > > > specific
> > > > > relationship; however, the class gets precedence, so if your class
> > isn't
> > > > set
> > > > > to lazy load (which was the default) then the references call won't
> > have
> > > > any
> > > > > effect.
>
> > > > > As Seb said, the reason the class lazy load requires virtual methods
> > is
> > > > > because it creates a proxy of the entity. If your methods aren't
> > already
> > > > > virtual, then your lazy loading won't be working because NHibernate
> > won't
> > > > > know how to track it.
>
> > > > > So what do you need to do? Update your copy of FNH and try again,
> > failing
> > > > > that, explicitly set lazy loading in your class and use virtuals;
> > that's
> > > > the
> > > > > recommended approach.
>
> > > > > Please note, this isn't a Fluent NHibernate specific issue, you'd be
> > > > seeing
> > > > > the same behaviour for standard xml mapping too.
>
> > > > > On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum 
> > > > wrote:
> > > > > > When it comes to issues such as this I am somewhat of a broken
> > record -
> > > > my
> > > > > > suggestion is always the same:
>
> > > > > > See if you can get the desired behavior using HBM xml. Once you
> > have
> > > > > > working xml, we can compare it to what fluent nhibernate is
> > generating
> > > > and
> > > > > > see where the problem lies.
>
> > > > > > Paul Batum
>
> > > > > > On Mon

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

Just after writing my last message I wondered: "if he tells me it
should be true, then I am certainly doing something wrong with
referencing the latest FNH". So I did it again, and you're right, it
defaults to true now. So from here, I will redo all my tests and
report.

On Jan 26, 10:09 am, James Gregory  wrote:
> How are you getting your fluent mappings into nhibernate? default-lazy
> should definitely be true if you're running on the latest trunk.
>
> On Mon, Jan 26, 2009 at 2:54 PM, VisualHint  wrote:
>
> > If I call System.Xml.XmlDocument doc = CreateMapping(new
> > FluentNHibernate.MappingVisitor());
>
> > I get an hbm that has default-lazy=false and I can assure you that I
> > got the latest FNH from the trunk, rebuilt it and referenced it. The
> > various lazy settings are correctly added in the xml file for the 2
> > versions of LazyLoad() methods.
> > I don't touch to the conventions.
> > Configuration is done through the hibernate.cfg.xml and it contains
> > only the minimum:
>
> > 
> > 
> >  
> >    Server=.
> > \SQLEXPRESS;Database=mydb;Integrated Security=True;
> >    NHibernate.Dialect.MsSql2005Dialect > property>
> >     > name="connection.provider">NHibernate.Connection.DriverConnectionProvider > property>
> >     > name="connection.driver_class">NHibernate.Driver.SqlClientDriver > property>
> >    auto
> >    500
>
> >    true
> >    true
>
> >  
> > 
>
> > On Jan 26, 9:45 am, James Gregory  wrote:
> > > By default the "default-lazy" attribute is set to true on every mapping
> > > created by Fluent NHibernate, so unless you've overridden this using the
> > > conventions, that's what's getting set. As far as I understand, this
> > infers
> > > the class level setting.
> > > How are you configuring your session factory? Could you write out your
> > > mappings using the WriteMappingsTo method of the PersistenceModel, then
> > we
> > > can see what's actually being generated.
>
> > > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint  wrote:
>
> > > > I use the latest FNH and it still doesn't work. I have to explicitely
> > > > set LazyLoad on the classmap to get this behavior.
> > > > I understand the difference between the 2 lazyload methods but I don't
> > > > understand when you say:
>
> > > > > however, the class gets precedence, so if your class isn't set
> > > > > to lazy load (which was the default) then the references call won't
> > have
> > > > any
> > > > > effect.
>
> > > > Logically, if the entity is not forced to LazLoad then calling it or
> > > > not on the association WOULD MAKE a difference.
> > > > If you force it on the classmap then calling LazyLoad on the
> > > > association would not change anything. If a NotLazyLoaded was possible
> > > > on the association, then this one would make a difference. No?
>
> > > > About trying with hbm, unfortunately, I tried to learn FNH before HBM
> > > > so this is not something I can immediately try.
>
> > > > N.
>
> > > > On Jan 26, 7:14 am, James Gregory  wrote:
> > > > > @Nicolas: How old is your copy of Fluent NHibernate? Originally it
> > was
> > > > the
> > > > > default that all entities would be not lazy loaded; so if your copy
> > is
> > > > from
> > > > > then, you won't see the lazy load behaviour.
> > > > > The two different lazy load methods you spoke of do different things,
> > the
> > > > > lazy load on the class sets it at the entity level, so whenever that
> > > > entity
> > > > > is referenced anywhere it's lazy loaded, the other sets it for that
> > > > specific
> > > > > relationship; however, the class gets precedence, so if your class
> > isn't
> > > > set
> > > > > to lazy load (which was the default) then the references call won't
> > have
> > > > any
> > > > > effect.
>
> > > > > As Seb said, the reason the class lazy load requires virtual methods
> > is
> > > > > because it creates a proxy of the entity. If your methods aren't
> > already
> > > > > virtual, then your lazy loading won't be working because NHibernate
> > won't
> > > > > know how to track it.
>
> > > > > So what do you need to do? Update your copy of FNH and try again,
> > failing
> > > > > that, explicitly set lazy loading in your class and use virtuals;
> > that's
> > > > the
> > > > > recommended approach.
>
> > > > > Please note, this isn't a Fluent NHibernate specific issue, you'd be
> > > > seeing
> > > > > the same behaviour for standard xml mapping too.
>
> > > > > On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum 
> > > > wrote:
> > > > > > When it comes to issues such as this I am somewhat of a broken
> > record -
> > > > my
> > > > > > suggestion is always the same:
>
> > > > > > See if you can get the desired behavior using HBM xml. Once you
> > have
> > > > > > working xml, we can compare it to what fluent nhibernate is
> > generating
> > > > and
> > > > > > see where the problem lies.
>
> > > > > > Paul Batum
>
> > > > > > On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic 
> > > > wrote:
>
> > > > > >> I noticed this also but I assumed I was handli

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
How are you getting your fluent mappings into nhibernate? default-lazy
should definitely be true if you're running on the latest trunk.

On Mon, Jan 26, 2009 at 2:54 PM, VisualHint  wrote:

>
> If I call System.Xml.XmlDocument doc = CreateMapping(new
> FluentNHibernate.MappingVisitor());
>
> I get an hbm that has default-lazy=false and I can assure you that I
> got the latest FNH from the trunk, rebuilt it and referenced it. The
> various lazy settings are correctly added in the xml file for the 2
> versions of LazyLoad() methods.
> I don't touch to the conventions.
> Configuration is done through the hibernate.cfg.xml and it contains
> only the minimum:
>
> 
> 
>  
>Server=.
> \SQLEXPRESS;Database=mydb;Integrated Security=True;
>NHibernate.Dialect.MsSql2005Dialect property>
> name="connection.provider">NHibernate.Connection.DriverConnectionProvider property>
> name="connection.driver_class">NHibernate.Driver.SqlClientDriver property>
>auto
>500
>
>true
>true
>
>  
> 
>
>
> On Jan 26, 9:45 am, James Gregory  wrote:
> > By default the "default-lazy" attribute is set to true on every mapping
> > created by Fluent NHibernate, so unless you've overridden this using the
> > conventions, that's what's getting set. As far as I understand, this
> infers
> > the class level setting.
> > How are you configuring your session factory? Could you write out your
> > mappings using the WriteMappingsTo method of the PersistenceModel, then
> we
> > can see what's actually being generated.
> >
> > On Mon, Jan 26, 2009 at 1:58 PM, VisualHint  wrote:
> >
> > > I use the latest FNH and it still doesn't work. I have to explicitely
> > > set LazyLoad on the classmap to get this behavior.
> > > I understand the difference between the 2 lazyload methods but I don't
> > > understand when you say:
> >
> > > > however, the class gets precedence, so if your class isn't set
> > > > to lazy load (which was the default) then the references call won't
> have
> > > any
> > > > effect.
> >
> > > Logically, if the entity is not forced to LazLoad then calling it or
> > > not on the association WOULD MAKE a difference.
> > > If you force it on the classmap then calling LazyLoad on the
> > > association would not change anything. If a NotLazyLoaded was possible
> > > on the association, then this one would make a difference. No?
> >
> > > About trying with hbm, unfortunately, I tried to learn FNH before HBM
> > > so this is not something I can immediately try.
> >
> > > N.
> >
> > > On Jan 26, 7:14 am, James Gregory  wrote:
> > > > @Nicolas: How old is your copy of Fluent NHibernate? Originally it
> was
> > > the
> > > > default that all entities would be not lazy loaded; so if your copy
> is
> > > from
> > > > then, you won't see the lazy load behaviour.
> > > > The two different lazy load methods you spoke of do different things,
> the
> > > > lazy load on the class sets it at the entity level, so whenever that
> > > entity
> > > > is referenced anywhere it's lazy loaded, the other sets it for that
> > > specific
> > > > relationship; however, the class gets precedence, so if your class
> isn't
> > > set
> > > > to lazy load (which was the default) then the references call won't
> have
> > > any
> > > > effect.
> >
> > > > As Seb said, the reason the class lazy load requires virtual methods
> is
> > > > because it creates a proxy of the entity. If your methods aren't
> already
> > > > virtual, then your lazy loading won't be working because NHibernate
> won't
> > > > know how to track it.
> >
> > > > So what do you need to do? Update your copy of FNH and try again,
> failing
> > > > that, explicitly set lazy loading in your class and use virtuals;
> that's
> > > the
> > > > recommended approach.
> >
> > > > Please note, this isn't a Fluent NHibernate specific issue, you'd be
> > > seeing
> > > > the same behaviour for standard xml mapping too.
> >
> > > > On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum 
> > > wrote:
> > > > > When it comes to issues such as this I am somewhat of a broken
> record -
> > > my
> > > > > suggestion is always the same:
> >
> > > > > See if you can get the desired behavior using HBM xml. Once you
> have
> > > > > working xml, we can compare it to what fluent nhibernate is
> generating
> > > and
> > > > > see where the problem lies.
> >
> > > > > Paul Batum
> >
> > > > > On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic 
> > > wrote:
> >
> > > > >> I noticed this also but I assumed I was handling the session
> > > > >> incorrectly making it fully load the object but maybe this
> actually is
> > > > >> an issue.
> >
> > > > >> On Jan 25, 9:20 am, VisualHint  wrote:
> > > > >> > Yes I know that Seb (thx anyway). This was just telling a fact.
> > > > >> > My question is about LazyLoad and why it has no effect when
> called
> > > on
> > > > >> > a References() call.
> >
> > > > >> > Nicolas
> >
> > > > >> > On Jan 25, 3:44 am, Sebastien Lambla 
> wrote:
> >
> > > > >> > > > But doing that has a c

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread Luis Abreu
Btw, this is a problem I've faced in my mappings. Shouldn't the lazy
attribute that you apply to a class element override that mapping? I'm
asking this because I've had to change the default convention on my mappings
so that I could discard the lazy loading options since it always insisted in
using that when it read the xml generated by the mappers.

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: segunda-feira, 26 de Janeiro de 2009 14:45
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: Need some explanations about LazyLoad method

 

By default the "default-lazy" attribute is set to true on every mapping
created by Fluent NHibernate, so unless you've overridden this using the
conventions, that's what's getting set. As far as I understand, this infers
the class level setting.

 

How are you configuring your session factory? Could you write out your
mappings using the WriteMappingsTo method of the PersistenceModel, then we
can see what's actually being generated.

 

On Mon, Jan 26, 2009 at 1:58 PM, VisualHint  wrote:


I use the latest FNH and it still doesn't work. I have to explicitely
set LazyLoad on the classmap to get this behavior.
I understand the difference between the 2 lazyload methods but I don't
understand when you say:


> however, the class gets precedence, so if your class isn't set
> to lazy load (which was the default) then the references call won't have
any
> effect.

Logically, if the entity is not forced to LazLoad then calling it or
not on the association WOULD MAKE a difference.
If you force it on the classmap then calling LazyLoad on the
association would not change anything. If a NotLazyLoaded was possible
on the association, then this one would make a difference. No?

About trying with hbm, unfortunately, I tried to learn FNH before HBM
so this is not something I can immediately try.

N.



On Jan 26, 7:14 am, James Gregory  wrote:
> @Nicolas: How old is your copy of Fluent NHibernate? Originally it was the
> default that all entities would be not lazy loaded; so if your copy is
from
> then, you won't see the lazy load behaviour.
> The two different lazy load methods you spoke of do different things, the
> lazy load on the class sets it at the entity level, so whenever that
entity
> is referenced anywhere it's lazy loaded, the other sets it for that
specific
> relationship; however, the class gets precedence, so if your class isn't
set
> to lazy load (which was the default) then the references call won't have
any
> effect.
>
> As Seb said, the reason the class lazy load requires virtual methods is
> because it creates a proxy of the entity. If your methods aren't already
> virtual, then your lazy loading won't be working because NHibernate won't
> know how to track it.
>
> So what do you need to do? Update your copy of FNH and try again, failing
> that, explicitly set lazy loading in your class and use virtuals; that's
the
> recommended approach.
>
> Please note, this isn't a Fluent NHibernate specific issue, you'd be
seeing
> the same behaviour for standard xml mapping too.
>

> On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum  wrote:
> > When it comes to issues such as this I am somewhat of a broken record -
my
> > suggestion is always the same:
>
> > See if you can get the desired behavior using HBM xml. Once you have
> > working xml, we can compare it to what fluent nhibernate is generating
and
> > see where the problem lies.
>
> > Paul Batum
>

> > On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic 
wrote:
>
> >> I noticed this also but I assumed I was handling the session
> >> incorrectly making it fully load the object but maybe this actually is
> >> an issue.
>
> >> On Jan 25, 9:20 am, VisualHint  wrote:
> >> > Yes I know that Seb (thx anyway). This was just telling a fact.
> >> > My question is about LazyLoad and why it has no effect when called on
> >> > a References() call.
>
> >> > Nicolas
>
> >> > On Jan 25, 3:44 am, Sebastien Lambla  wrote:
>
> >> > > > But doing that has a consequence: All my properties in> the "one"
> >> model must be virtual, even the ones that are not related to> fields in
my
> >> database.
>
> >> > > That's because the object is created as a proxy. Any of your
property
> >> may have access or rely on other properties that need to be hydrated
from
> >> the db. They all need to be virtual so that the first cal can trigger
the
> >> load. This is an nhibernate thing.
>
> >> > > --
> >> > > Seb
> >> > > _
> >> > > Windows Live Messenger just got better .Video display pics, contact
> >> updates & more.http://www.download.live.com/messenger



 




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

If I call System.Xml.XmlDocument doc = CreateMapping(new
FluentNHibernate.MappingVisitor());

I get an hbm that has default-lazy=false and I can assure you that I
got the latest FNH from the trunk, rebuilt it and referenced it. The
various lazy settings are correctly added in the xml file for the 2
versions of LazyLoad() methods.
I don't touch to the conventions.
Configuration is done through the hibernate.cfg.xml and it contains
only the minimum:



  
Server=.
\SQLEXPRESS;Database=mydb;Integrated Security=True;
NHibernate.Dialect.MsSql2005Dialect
NHibernate.Connection.DriverConnectionProvider
NHibernate.Driver.SqlClientDriver
auto
500

true
true

  



On Jan 26, 9:45 am, James Gregory  wrote:
> By default the "default-lazy" attribute is set to true on every mapping
> created by Fluent NHibernate, so unless you've overridden this using the
> conventions, that's what's getting set. As far as I understand, this infers
> the class level setting.
> How are you configuring your session factory? Could you write out your
> mappings using the WriteMappingsTo method of the PersistenceModel, then we
> can see what's actually being generated.
>
> On Mon, Jan 26, 2009 at 1:58 PM, VisualHint  wrote:
>
> > I use the latest FNH and it still doesn't work. I have to explicitely
> > set LazyLoad on the classmap to get this behavior.
> > I understand the difference between the 2 lazyload methods but I don't
> > understand when you say:
>
> > > however, the class gets precedence, so if your class isn't set
> > > to lazy load (which was the default) then the references call won't have
> > any
> > > effect.
>
> > Logically, if the entity is not forced to LazLoad then calling it or
> > not on the association WOULD MAKE a difference.
> > If you force it on the classmap then calling LazyLoad on the
> > association would not change anything. If a NotLazyLoaded was possible
> > on the association, then this one would make a difference. No?
>
> > About trying with hbm, unfortunately, I tried to learn FNH before HBM
> > so this is not something I can immediately try.
>
> > N.
>
> > On Jan 26, 7:14 am, James Gregory  wrote:
> > > @Nicolas: How old is your copy of Fluent NHibernate? Originally it was
> > the
> > > default that all entities would be not lazy loaded; so if your copy is
> > from
> > > then, you won't see the lazy load behaviour.
> > > The two different lazy load methods you spoke of do different things, the
> > > lazy load on the class sets it at the entity level, so whenever that
> > entity
> > > is referenced anywhere it's lazy loaded, the other sets it for that
> > specific
> > > relationship; however, the class gets precedence, so if your class isn't
> > set
> > > to lazy load (which was the default) then the references call won't have
> > any
> > > effect.
>
> > > As Seb said, the reason the class lazy load requires virtual methods is
> > > because it creates a proxy of the entity. If your methods aren't already
> > > virtual, then your lazy loading won't be working because NHibernate won't
> > > know how to track it.
>
> > > So what do you need to do? Update your copy of FNH and try again, failing
> > > that, explicitly set lazy loading in your class and use virtuals; that's
> > the
> > > recommended approach.
>
> > > Please note, this isn't a Fluent NHibernate specific issue, you'd be
> > seeing
> > > the same behaviour for standard xml mapping too.
>
> > > On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum 
> > wrote:
> > > > When it comes to issues such as this I am somewhat of a broken record -
> > my
> > > > suggestion is always the same:
>
> > > > See if you can get the desired behavior using HBM xml. Once you have
> > > > working xml, we can compare it to what fluent nhibernate is generating
> > and
> > > > see where the problem lies.
>
> > > > Paul Batum
>
> > > > On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic 
> > wrote:
>
> > > >> I noticed this also but I assumed I was handling the session
> > > >> incorrectly making it fully load the object but maybe this actually is
> > > >> an issue.
>
> > > >> On Jan 25, 9:20 am, VisualHint  wrote:
> > > >> > Yes I know that Seb (thx anyway). This was just telling a fact.
> > > >> > My question is about LazyLoad and why it has no effect when called
> > on
> > > >> > a References() call.
>
> > > >> > Nicolas
>
> > > >> > On Jan 25, 3:44 am, Sebastien Lambla  wrote:
>
> > > >> > > > But doing that has a consequence: All my properties in> the
> > "one"
> > > >> model must be virtual, even the ones that are not related to> fields
> > in my
> > > >> database.
>
> > > >> > > That's because the object is created as a proxy. Any of your
> > property
> > > >> may have access or rely on other properties that need to be hydrated
> > from
> > > >> the db. They all need to be virtual so that the first cal can trigger
> > the
> > > >> load. This is an nhibernate thing.
>
> > > >> > > --
> > > >> > > Seb
> > > >> > > ___

[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
By default the "default-lazy" attribute is set to true on every mapping
created by Fluent NHibernate, so unless you've overridden this using the
conventions, that's what's getting set. As far as I understand, this infers
the class level setting.
How are you configuring your session factory? Could you write out your
mappings using the WriteMappingsTo method of the PersistenceModel, then we
can see what's actually being generated.
On Mon, Jan 26, 2009 at 1:58 PM, VisualHint  wrote:

>
> I use the latest FNH and it still doesn't work. I have to explicitely
> set LazyLoad on the classmap to get this behavior.
> I understand the difference between the 2 lazyload methods but I don't
> understand when you say:
>
> > however, the class gets precedence, so if your class isn't set
> > to lazy load (which was the default) then the references call won't have
> any
> > effect.
>
> Logically, if the entity is not forced to LazLoad then calling it or
> not on the association WOULD MAKE a difference.
> If you force it on the classmap then calling LazyLoad on the
> association would not change anything. If a NotLazyLoaded was possible
> on the association, then this one would make a difference. No?
>
> About trying with hbm, unfortunately, I tried to learn FNH before HBM
> so this is not something I can immediately try.
>
> N.
>
>
> On Jan 26, 7:14 am, James Gregory  wrote:
> > @Nicolas: How old is your copy of Fluent NHibernate? Originally it was
> the
> > default that all entities would be not lazy loaded; so if your copy is
> from
> > then, you won't see the lazy load behaviour.
> > The two different lazy load methods you spoke of do different things, the
> > lazy load on the class sets it at the entity level, so whenever that
> entity
> > is referenced anywhere it's lazy loaded, the other sets it for that
> specific
> > relationship; however, the class gets precedence, so if your class isn't
> set
> > to lazy load (which was the default) then the references call won't have
> any
> > effect.
> >
> > As Seb said, the reason the class lazy load requires virtual methods is
> > because it creates a proxy of the entity. If your methods aren't already
> > virtual, then your lazy loading won't be working because NHibernate won't
> > know how to track it.
> >
> > So what do you need to do? Update your copy of FNH and try again, failing
> > that, explicitly set lazy loading in your class and use virtuals; that's
> the
> > recommended approach.
> >
> > Please note, this isn't a Fluent NHibernate specific issue, you'd be
> seeing
> > the same behaviour for standard xml mapping too.
> >
> > On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum 
> wrote:
> > > When it comes to issues such as this I am somewhat of a broken record -
> my
> > > suggestion is always the same:
> >
> > > See if you can get the desired behavior using HBM xml. Once you have
> > > working xml, we can compare it to what fluent nhibernate is generating
> and
> > > see where the problem lies.
> >
> > > Paul Batum
> >
> > > On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic 
> wrote:
> >
> > >> I noticed this also but I assumed I was handling the session
> > >> incorrectly making it fully load the object but maybe this actually is
> > >> an issue.
> >
> > >> On Jan 25, 9:20 am, VisualHint  wrote:
> > >> > Yes I know that Seb (thx anyway). This was just telling a fact.
> > >> > My question is about LazyLoad and why it has no effect when called
> on
> > >> > a References() call.
> >
> > >> > Nicolas
> >
> > >> > On Jan 25, 3:44 am, Sebastien Lambla  wrote:
> >
> > >> > > > But doing that has a consequence: All my properties in> the
> "one"
> > >> model must be virtual, even the ones that are not related to> fields
> in my
> > >> database.
> >
> > >> > > That's because the object is created as a proxy. Any of your
> property
> > >> may have access or rely on other properties that need to be hydrated
> from
> > >> the db. They all need to be virtual so that the first cal can trigger
> the
> > >> load. This is an nhibernate thing.
> >
> > >> > > --
> > >> > > Seb
> > >> > > _
> > >> > > Windows Live Messenger just got better .Video display pics,
> contact
> > >> updates & more.http://www.download.live.com/messenger
>
> >
>

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



[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread VisualHint

I use the latest FNH and it still doesn't work. I have to explicitely
set LazyLoad on the classmap to get this behavior.
I understand the difference between the 2 lazyload methods but I don't
understand when you say:

> however, the class gets precedence, so if your class isn't set
> to lazy load (which was the default) then the references call won't have any
> effect.

Logically, if the entity is not forced to LazLoad then calling it or
not on the association WOULD MAKE a difference.
If you force it on the classmap then calling LazyLoad on the
association would not change anything. If a NotLazyLoaded was possible
on the association, then this one would make a difference. No?

About trying with hbm, unfortunately, I tried to learn FNH before HBM
so this is not something I can immediately try.

N.


On Jan 26, 7:14 am, James Gregory  wrote:
> @Nicolas: How old is your copy of Fluent NHibernate? Originally it was the
> default that all entities would be not lazy loaded; so if your copy is from
> then, you won't see the lazy load behaviour.
> The two different lazy load methods you spoke of do different things, the
> lazy load on the class sets it at the entity level, so whenever that entity
> is referenced anywhere it's lazy loaded, the other sets it for that specific
> relationship; however, the class gets precedence, so if your class isn't set
> to lazy load (which was the default) then the references call won't have any
> effect.
>
> As Seb said, the reason the class lazy load requires virtual methods is
> because it creates a proxy of the entity. If your methods aren't already
> virtual, then your lazy loading won't be working because NHibernate won't
> know how to track it.
>
> So what do you need to do? Update your copy of FNH and try again, failing
> that, explicitly set lazy loading in your class and use virtuals; that's the
> recommended approach.
>
> Please note, this isn't a Fluent NHibernate specific issue, you'd be seeing
> the same behaviour for standard xml mapping too.
>
> On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum  wrote:
> > When it comes to issues such as this I am somewhat of a broken record - my
> > suggestion is always the same:
>
> > See if you can get the desired behavior using HBM xml. Once you have
> > working xml, we can compare it to what fluent nhibernate is generating and
> > see where the problem lies.
>
> > Paul Batum
>
> > On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic  wrote:
>
> >> I noticed this also but I assumed I was handling the session
> >> incorrectly making it fully load the object but maybe this actually is
> >> an issue.
>
> >> On Jan 25, 9:20 am, VisualHint  wrote:
> >> > Yes I know that Seb (thx anyway). This was just telling a fact.
> >> > My question is about LazyLoad and why it has no effect when called on
> >> > a References() call.
>
> >> > Nicolas
>
> >> > On Jan 25, 3:44 am, Sebastien Lambla  wrote:
>
> >> > > > But doing that has a consequence: All my properties in> the "one"
> >> model must be virtual, even the ones that are not related to> fields in my
> >> database.
>
> >> > > That's because the object is created as a proxy. Any of your property
> >> may have access or rely on other properties that need to be hydrated from
> >> the db. They all need to be virtual so that the first cal can trigger the
> >> load. This is an nhibernate thing.
>
> >> > > --
> >> > > Seb
> >> > > _
> >> > > Windows Live Messenger just got better .Video display pics, contact
> >> updates & more.http://www.download.live.com/messenger

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



[fluent-nhib] Re: still about signing the assembly

2009-01-26 Thread Luis Abreu
Yep, I've noticed that while trying to sign them with the keys that is
shipped with the code. This is a big problem because I must sign my
assemblies and the latest releases of fluent NH don't allow me to do that to
the framework assembly.

 

Thanks again.

 

From: fluent-nhibernate@googlegroups.com
[mailto:fluent-nhibern...@googlegroups.com] On Behalf Of James Gregory
Sent: segunda-feira, 26 de Janeiro de 2009 12:39
To: fluent-nhibernate@googlegroups.com
Subject: [fluent-nhib] Re: still about signing the assembly

 

I've come across a problem with this. The FluentNHibernate.Framework project
references assemblies that aren't signed themselves, which prevents us from
signing it; I don't really want to sign only half of FNH!

 

I'll see if I can remove the offending assemblies, but I don't know yet.

On Fri, Jan 23, 2009 at 12:13 PM, Luis Abreu  wrote:


Hello guys,

I've just run na svn update on the fluent solution and it looks like it
still doesn't sign the assembly and adds the APTA attribute by default. I
was under the impression that this had been discussed here and fixed. Can
anyone confirm it? And if that is correct, when can we get that update?

Thanks,
Luis




 




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



[fluent-nhib] Re: PersistenceSpecification: Custom setter for Property, List, Reference (Issue 62)

2009-01-26 Thread James Gregory
I've just applied this, sorry it's taken so long.

On Thu, Jan 22, 2009 at 9:45 AM, Stefan Lieser wrote:

>
> Ok, no problem, you all do a great job!!
>
> James Gregory schrieb:
> > Time :)
> >
> > On 1/22/09, Stefan Lieser  wrote:
> >> There was a patch uploaded to support custom setter methods in
> >> PersistenceSpecification. You need this if your domain model doesn't
> >> have public getter/setter properties but setter methods for example.
> >>
> >> The patch is not applied yet. Is this because nobody found the time to
> >> verify and apply the patch or do you think it should not be applied for
> >> other reasons?
> >>
> >>
> >> Cheers
> >> Stefan Lieser
> >> --
> >> http://clean-code-developer.de
> >> http://nhplugin.lieser-online.de
> >>
> >>
> >
> > >
> >
> >
> > 
> >
> >
> > No virus found in this incoming message.
> > Checked by AVG - http://www.avg.com
> > Version: 8.0.176 / Virus Database: 270.10.12/1908 - Release Date:
> 21.01.2009 21:15
> >
>
> >
>

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



[fluent-nhib] Fit stuff in Framework

2009-01-26 Thread James Gregory
Guys,

Is anyone using the Fit stuff in the Framework project? The fit assemblies
aren't signed, so they're preventing us from signing ours. If nobody's using
it then I'll just bin the fit stuff, but if someone is I'll look at
recompiling fit to be signed.
James

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



[fluent-nhib] Re: still about signing the assembly

2009-01-26 Thread James Gregory
I've come across a problem with this. The FluentNHibernate.Framework project
references assemblies that aren't signed themselves, which prevents us from
signing it; I don't really want to sign only half of FNH!
I'll see if I can remove the offending assemblies, but I don't know yet.

On Fri, Jan 23, 2009 at 12:13 PM, Luis Abreu  wrote:

>
> Hello guys,
>
> I've just run na svn update on the fluent solution and it looks like it
> still doesn't sign the assembly and adds the APTA attribute by default. I
> was under the impression that this had been discussed here and fixed. Can
> anyone confirm it? And if that is correct, when can we get that update?
>
> Thanks,
> Luis
>
>
> >
>

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



[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread James Gregory
@Nicolas: How old is your copy of Fluent NHibernate? Originally it was the
default that all entities would be not lazy loaded; so if your copy is from
then, you won't see the lazy load behaviour.
The two different lazy load methods you spoke of do different things, the
lazy load on the class sets it at the entity level, so whenever that entity
is referenced anywhere it's lazy loaded, the other sets it for that specific
relationship; however, the class gets precedence, so if your class isn't set
to lazy load (which was the default) then the references call won't have any
effect.

As Seb said, the reason the class lazy load requires virtual methods is
because it creates a proxy of the entity. If your methods aren't already
virtual, then your lazy loading won't be working because NHibernate won't
know how to track it.

So what do you need to do? Update your copy of FNH and try again, failing
that, explicitly set lazy loading in your class and use virtuals; that's the
recommended approach.

Please note, this isn't a Fluent NHibernate specific issue, you'd be seeing
the same behaviour for standard xml mapping too.

On Mon, Jan 26, 2009 at 8:57 AM, Paul Batum  wrote:

> When it comes to issues such as this I am somewhat of a broken record - my
> suggestion is always the same:
>
> See if you can get the desired behavior using HBM xml. Once you have
> working xml, we can compare it to what fluent nhibernate is generating and
> see where the problem lies.
>
> Paul Batum
>
>
> On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic  wrote:
>
>>
>> I noticed this also but I assumed I was handling the session
>> incorrectly making it fully load the object but maybe this actually is
>> an issue.
>>
>> On Jan 25, 9:20 am, VisualHint  wrote:
>> > Yes I know that Seb (thx anyway). This was just telling a fact.
>> > My question is about LazyLoad and why it has no effect when called on
>> > a References() call.
>> >
>> > Nicolas
>> >
>> > On Jan 25, 3:44 am, Sebastien Lambla  wrote:
>> >
>> > > > But doing that has a consequence: All my properties in> the "one"
>> model must be virtual, even the ones that are not related to> fields in my
>> database.
>> >
>> > > That's because the object is created as a proxy. Any of your property
>> may have access or rely on other properties that need to be hydrated from
>> the db. They all need to be virtual so that the first cal can trigger the
>> load. This is an nhibernate thing.
>> >
>> > > --
>> > > Seb
>> > > _
>> > > Windows Live Messenger just got better .Video display pics, contact
>> updates & more.http://www.download.live.com/messenger
>>
>>
>
> >
>

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



[fluent-nhib] Re: Need some explanations about LazyLoad method

2009-01-26 Thread Paul Batum
When it comes to issues such as this I am somewhat of a broken record - my
suggestion is always the same:

See if you can get the desired behavior using HBM xml. Once you have working
xml, we can compare it to what fluent nhibernate is generating and see where
the problem lies.

Paul Batum

On Mon, Jan 26, 2009 at 9:16 AM, Chris Marisic  wrote:

>
> I noticed this also but I assumed I was handling the session
> incorrectly making it fully load the object but maybe this actually is
> an issue.
>
> On Jan 25, 9:20 am, VisualHint  wrote:
> > Yes I know that Seb (thx anyway). This was just telling a fact.
> > My question is about LazyLoad and why it has no effect when called on
> > a References() call.
> >
> > Nicolas
> >
> > On Jan 25, 3:44 am, Sebastien Lambla  wrote:
> >
> > > > But doing that has a consequence: All my properties in> the "one"
> model must be virtual, even the ones that are not related to> fields in my
> database.
> >
> > > That's because the object is created as a proxy. Any of your property
> may have access or rely on other properties that need to be hydrated from
> the db. They all need to be virtual so that the first cal can trigger the
> load. This is an nhibernate thing.
> >
> > > --
> > > Seb
> > > _
> > > Windows Live Messenger just got better .Video display pics, contact
> updates & more.http://www.download.live.com/messenger
> >
>

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