Please show the real mapping, and the NH query that you try to use.
On Wed, Mar 4, 2009 at 10:03 AM, Scott Belchak <[email protected]> wrote:
> I am stumped. I've been over this too many times and it's time for some
> extra eyes on my problem.
>
> I'm using FluentNHibernate for my mappings.
>
> The problem that I am having is that when I am querying my League table for
> a League that has a specified ID, the generated SQL tries to match the ID up
> with a Sub Classes ID instead of the parent class.
>
> For instance.
>
> League
> BaseballLeague : League
> FootballLeague : League
>
> I get nothing back if I pass in an ID of a FootballLeague.
>
> (all of the mapping for the main class gets done in the
> NamedDomainObjectMap)
>
> public class LeagueMap : NamedDomainObjectMap<League>
> {
> /// <summary>
> /// Initializes a new instance of the LeagueMap class.
> /// </summary>
> public LeagueMap()
> : base()
> {
> var ncaaMap = JoinedSubClass<NcaaLeague>("NcaaLeagueId", sub
> => sub.Map(x => x.Id));
> var mlbMap = JoinedSubClass<MlbLeague>("MlbLeagueId", sub =>
> sub.Map(x => x.Id));
> }
> }
>
>
>
>
> var criteria = Session.CreateCriteria(typeof(League))
> .Add(Expression.Eq("Id", id ))
> .UniqueResult<League>();
>
> the generated where statement is:
>
> WHERE this_1_.Id* *= 'f5e2e4ef-a682-439f-b0f1-22906b71953d' /* @p0 */
>
> it works perfectly if I change it to WHERE* * this_.Id =
> 'f5e2e4ef-a682-439f-b0f1-22906b71953d' /* @p0 */
>
> So you see, it's going off the first subclass to be mapped. What the hell
> is going wrong?
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---