ComponentMap<> problem

Lex Lavnikov's Avatar

Lex Lavnikov

22 Apr, 2010 09:25 AM via web

I have two classes like this:

public class CultureSettings 
{
  public virtual string DefaultCulture { get;set;}
  public virtual bool IsConfigurable { get;set;}
  public virtual string SupportedCultures { get;set;}
}

public class Environment 
{
  public virtual Guid Id { get; set; }
  public virtual string Name { get; set;}
  public virtual CultureSettings UICulture { get; set;}
  public virtual CultureSettings DBCulture { get; set;}
}

Fluent mapping looks like this:

class CultureSettingsMapping: ComponentMap<CultureSettings>
{
  public  CultureSettingsMapping() 
  {
    Map(x => x.DefaultCulture).Column("CULTUREDEFAULT");
    Map(x => x.IsConfigurable).Column("CULTURECONFIGURABLE");
    Map(x => x.SupportedCultures).Column("SUPPORTEDCULTURES");
  }
}

public class EnvironmentMapping: ClassMap<Environment>
{
  public void EnvironmentMapping() 
  {
     Table("ENVIRONMENT");
     Id(x => x.Id);
     Map(x => x.Name);
     Component(x => x.DBCultture).ColumnPrefix("DB");
     Component(x => x.UICultture).ColumnPrefix("UI");
  }
}

Using Oracle driver trying to load my table I'm getting wrong SQL:

select *
from (SELECT this_.Id                      as Id2_0_,
             this_.UIDBCULTUREDEFAULT      as UIDBCULT2_2_0_,
             this_.UIDBCULTURECONFIGURABLE as UIDBCULT3_2_0_,
             this_.UIDBSUPPORTEDCULTURES   as UIDBSUPP4_2_0_,
             this_.Name                    as Name2_0_
        FROM ENVIRONMENT this_)

while correct SQL should look somewhat like this:

select *
from (SELECT this_.Id,
             this_.DBCULTUREDEFAULT,
             this_.DBCULTURECONFIGURABLE,
             this_.DBSUPPORTEDCULTURES,
             this_.UICULTUREDEFAULT,
             this_.UICULTURECONFIGURABLE,
             this_.UISUPPORTEDCULTURES,
             this_.Name
        FROM ENVIRONMENT this_)

What am I doing wrong here?

Thank you in advance

  1. Support Staff 2 Posted by James Gregory on 16 May, 2010 05:33 PM

    James Gregory's Avatar

    Your ComponentMap needs to be public.

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

    You can attach files up to 10MB

    What is the last month of the year?