It was more a suggestion for debugging rather than a design recommendation
:)

The "legacy" comment in the method doc pertains to a different usage of
AlwaysSelectWithValue than what you're doing. The true "legacy" use of that
method is for when you have a table with discriminators other than what
you've mapped, NHibernate would try to hydrate entities from those records
and fall over because there's no mapping for all the discriminator values,
the force/AlwaysSelectWithValue tells NHibernate to always explicitly
specify which discriminator values it should be fetching.

For your scenario, I think you can safely ignore the legacy comment as I'm
pretty sure it doesn't apply.

On Wed, Nov 24, 2010 at 10:08 PM, Tim Scott <[email protected]>wrote:

>  Thanks for the reply James.  So far, AlwaysSelectWithValue() is working
> fine.  I really don’t want to eager load these collections.
>
>
>
> On 11/24/10 3:57 PM, "James Gregory" <[email protected]> wrote:
>
> The issue isn't strictly collections of subclasses, it's *lazy* collections
> of subclasses. Try turning off lazy loading on those properties and see what
> happens, I believe it should all work as expected.
>
> Lazy loading and subclasses is a bit of a nightmare. It's the one place
> where proxying really does make you have to change how you work, which
> is disappointingly against the POCO principals.
>
> On Mon, Nov 22, 2010 at 11:14 PM, Tim Scott <[email protected]>
> wrote:
>
> I have a class hierarchy, which is mapped in the usual table-per-hierarchy
> way.
>
> FooBase
>    FooA
>    FooB
>
> The parent has two collections, which are lazy by convention:
>
> HasMany(x => x.FooA).Inverse();
> HasMany(x => x.FooB).Inverse();
>
> Upon initializing these I was getting WrongClassException.  I noticed that
> the SQL did not include the discriminator in the WHERE clause.  This says to
> solve it by forcing the discriminator:
> https://forum.hibernate.org/viewtopic.php?t=961213.
>
> So in the parent map:
>
> DiscriminateSubClassesOnColumn("Type").*AlwaysSelectWithValue*();
>
> However,  the doc for AlwaysSetWithValue says it’s used for legacy cases.
>  My question is, is there some more correct way to map subclasses that will
> also be collections?
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<fluent-nhibernate%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>

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

Reply via email to