Click here to Skip to main content
15,886,026 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Problem to submit an ASP.NET form by the ENTER KEY Pin
JacquesDP25-Oct-11 10:43
JacquesDP25-Oct-11 10:43 
GeneralRe: Problem to submit an ASP.NET form by the ENTER KEY Pin
parthibandharma21-Mar-13 20:25
professionalparthibandharma21-Mar-13 20:25 
GeneralRe: Problem to submit an ASP.NET form by the ENTER KEY Pin
parthibandharma24-Oct-11 21:19
professionalparthibandharma24-Oct-11 21:19 
GeneralRe: Problem to submit an ASP.NET form by the ENTER KEY Pin
JacquesDP24-Oct-11 23:17
JacquesDP24-Oct-11 23:17 
AnswerRe: Problem to submit an ASP.NET form by the ENTER KEY Pin
jkirkerx28-Oct-11 20:08
professionaljkirkerx28-Oct-11 20:08 
Questionheader on server control Pin
Member 821751723-Oct-11 8:42
Member 821751723-Oct-11 8:42 
AnswerRe: header on server control Pin
jkirkerx28-Oct-11 20:10
professionaljkirkerx28-Oct-11 20:10 
QuestionError mapping table per subclass in Fluent NHibernate Pin
AumSingh22-Oct-11 3:09
professionalAumSingh22-Oct-11 3:09 
I will give details of the infrastructure I have built and will talk about the problem in the end.

Database table "dbo.SmartPhoneBase" details: Following are the columns in the table.
SQL
SmartPhoneBaseID    (Identity Primary Key)
Company
PhoneName
RAM
Storage


Database table "dbo.SamsungPhone" details: Following are the columns in the table.
SQL
SamsungPhoneID    (Identity Primary Kay)
SmartPhoneBaseID  (Foreign Key to dbo.SmartPhoneBase)
AndroidVersion
QualcommProcessorTech
AMOLEDDisplayTech


Entity classes for the above tables:
C#
public class SmartPhoneBase
    {
        public virtual int SmartPhoneBaseID { get; private set; }

        public virtual string Company { get; set; }

        public virtual string PhoneName { get; set; }

        public virtual string RAM { get; set; }

        public virtual string Storage { get; set; }
    }

public class SamsungPhone:SmartPhoneBase
    {
        public virtual string AndroidVersion { get; set; }

        public virtual string QualcommProcessorTech { get; set; }

        public virtual string AMOLEDDisplayTech { get; set; }
    }


Mapping class for the above entity classes:
C#
public class SmartPhoneBaseMap:ClassMap<SmartPhoneBase>
    {
        public SmartPhoneBaseMap()
        {
            Schema("dbo");
            Table("SmartPhoneBase");

            Id(x => x.SmartPhoneBaseID)
                .Column("SmartPhoneBaseID")
                .GeneratedBy.Identity();

            Map(x => x.Company).Length(100).Not.Nullable();
            Map(x => x.PhoneName).Length(100).Not.Nullable();
            Map(x => x.RAM).Length(100).Not.Nullable();
            Map(x => x.Storage).Length(100).Not.Nullable();
        }
    }

public class SamsungPhoneMap:SubclassMap<SamsungPhone>
    {
        public SamsungPhoneMap()
        {
            Schema("dbo");
            Table("SamsungPhone");

            Map(x => x.AndroidVersion).Length(100).Not.Nullable();
            Map(x => x.QualcommProcessorTech).Length(100).Not.Nullable();
            Map(x => x.AMOLEDDisplayTech).Length(100).Not.Nullable();
        }
    }


Please note following points.
1. For the subclass "SamsungPhone" the primary key is not allowed to be mapped with the method Id() hence I did not keep the property for same reason in the subclass even though its corresponding table "dbo.SamsungPhone" has a primary key. I created it just for the sake of it.

2. The table "dbo.SamsungPhone" does refer to "dbo.SamrtPhoneBase". Initially I had created a One-To-One relation between their corresponding entities but I saw that the error still appeared as it is (error mentioned below). So for the sake of simplicity I removed the relation from mapping classes even thought it still exist in DB.

Now I wrote the following code in the page load of my sample web application.
C#
var result = nhSession.QueryOver<SmartPhoneBase>().List();


And following is the exception that is thrown and is visible on the browser.
HTML
Invalid column name 'SmartPhoneBase_id'.
Invalid column name 'SmartPhoneBase_id'.


Yes it appeared twice.

I am not sure what is going wrong but what I am sure about is that my fluent configuration and my other mappings are all correct as they are all working fine, even the mapping for table-per-class-hierarchy is correct and they are all working fine.

I need some help here.

Thanks in advance!
AnswerRe: Error mapping table per subclass in Fluent NHibernate Pin
AumSingh22-Oct-11 8:45
professionalAumSingh22-Oct-11 8:45 
QuestionProblem With Master Pages Pin
AmbiguousName21-Oct-11 7:13
AmbiguousName21-Oct-11 7:13 
AnswerRe: Problem With Master Pages Pin
Dennis E White21-Oct-11 10:25
professionalDennis E White21-Oct-11 10:25 
AnswerRe: Problem With Master Pages Pin
AmbiguousName21-Oct-11 18:54
AmbiguousName21-Oct-11 18:54 
Questionlist control with scroll bar Pin
sc steinhayse21-Oct-11 4:08
sc steinhayse21-Oct-11 4:08 
AnswerRe: list control with scroll bar Pin
Not Active21-Oct-11 4:25
mentorNot Active21-Oct-11 4:25 
Questionstep by step how to upload sql server database on webserver Pin
sheemap21-Oct-11 1:58
sheemap21-Oct-11 1:58 
AnswerRe: step by step how to upload sql server database on webserver Pin
Not Active21-Oct-11 2:11
mentorNot Active21-Oct-11 2:11 
Questionhow to sepeate all list Pin
poonam jagdale21-Oct-11 1:19
poonam jagdale21-Oct-11 1:19 
AnswerRe: how to sepeate all list Pin
Not Active21-Oct-11 2:08
mentorNot Active21-Oct-11 2:08 
Questionuser authentication in asp.net Pin
Member 829494421-Oct-11 0:24
Member 829494421-Oct-11 0:24 
AnswerRe: user authentication in asp.net Pin
JacquesDP25-Oct-11 10:49
JacquesDP25-Oct-11 10:49 
QuestionInvalid postback or callback argument Pin
Amit Spadez20-Oct-11 20:37
professionalAmit Spadez20-Oct-11 20:37 
AnswerRe: Invalid postback or callback argument Pin
jkirkerx28-Oct-11 20:18
professionaljkirkerx28-Oct-11 20:18 
Questionpass values to 2010 control Pin
dcof20-Oct-11 12:19
dcof20-Oct-11 12:19 
AnswerRe: pass values to 2010 control Pin
Ibrahim Hebish22-Oct-11 2:45
Ibrahim Hebish22-Oct-11 2:45 
GeneralRe: pass values to 2010 control Pin
umeshdwivedi kanpur23-Oct-11 4:55
umeshdwivedi kanpur23-Oct-11 4:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.