-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Fluent Subclasses on same table without DiscriminateSubClass
PostPosted: Mon Apr 18, 2011 11:13 am 
Newbie

Joined: Mon Apr 18, 2011 10:51 am
Posts: 2
Hello,

i have one Table "CustomerTable" and several classes wich all reffer to this table.

i.e.:
Code:
public class BaseCustomer{
int Id;
}
public class Customer : BaseCustomer {
string SomeString;
}

The Fluent Mapping would be like
Code:
public class BaseCustomerMaps : ClassMap<BaseCustomer>
    {
        public BaseCustomerMaps()
        {
            Table("CustomerTable");
            Id(a => a.Id);
           // DiscriminateSubClassesOnColumn("type");
    }
}
public class CustomerMaps : SubclassMap<Customer>
{
        public CustomerMaps()
        {
            Map(a => a.SomeString);
        }
}


So without using the "DiscriminateSubClassesOnColumn("type");" i will get a query like ... FROM database.dbo.CustomerTable ... JOIN database.dbo.Customer
Of course the second table does not exist, it is only the name of the Entity Class.

Using "DiscriminateSubClassesOnColumn("type");" would only select from the one correct table without joining - but it would create a where Statement "WHERE this_.type='Customer'" wich can not work as there is no such column.

So how do i tell Fluent NHibernate that there is only one Table but no Column which distinguishes the Entities?

I Can not change the Database or ignore existing Classes.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.