I thought that's exactly how the blog post I sent to you showed.  let me
try and define the question.

1.  you have a single table Company that holds 2 types of records Customers
and Vendors.
2.  The discriminator value for Customer is "Customer" and Vendor is
"Vendor"
3.  your domain objects are abstract Company and 2 concrete classes in
Customer and Vendor.

what does you db look like?  I'm assuming it looks like point #1 above.

what does you mapping look like?

The mapping from http://notherdev.blogspot.com/**2012/01/mapping-by-code-**
inheritance.html<http://notherdev.blogspot.com/2012/01/mapping-by-code-inheritance.html>
should
handle the scenario you are describing.


On Tue, Jan 8, 2013 at 12:39 PM, James Klett <[email protected]> wrote:

> Yes, I am mapping to a single table.  I do have a discriminator.
>
> Maybe I didn't explain it right in my original post.  I have Company,
> Customer, and Vendor.  Company is abstract.  the two sub classes have
> discriminator values "Customer" and "Vendor"..  Company does not have a
> value for the discriminator because it will never be created. Only Customer
> and Vendors will.  The custom tool in VS2012, is telling my I need a value
> for the discriminator in the Company class.  So, I am not sure what to do.
>
> Let me know what more info I can provide
>
> thanks
>
> JAMES
>
> On Monday, January 7, 2013 1:36:45 PM UTC-6, fknebels wrote:
>
>> So are you mapping to a single table in your db or are you mapping to 2
>> separate tables.  The use of a discriminator says a single table so while
>> you abstract Customer class won't have a Property name Discriminator, you
>> still have to map a discriminator column on your map.
>>
>> See this post on inheritance in NHibernate
>>
>> http://notherdev.blogspot.com/**2012/01/mapping-by-code-**
>> inheritance.html<http://notherdev.blogspot.com/2012/01/mapping-by-code-inheritance.html>
>>
>>
>> On Monday, January 7, 2013, James Klett wrote:
>>
>>> New first time to NHibernate, used another tool for years though.
>>> Working with already existing db design, that works with the other tool,
>>> getting this error with NHibernate - DevArt EntityDesigner
>>>
>>> Custom tool error: Invalid inheritance 'Company_Customer'. Base Class
>>> Discriminator Value is not specified..
>>> Single Table Inheritance:
>>>
>>> I have an abstract Company base class, and an inherited concrete
>>> Customer and Vendor Classes.
>>>
>>> the discriminator is string "Customer", "Vendor" and I have no
>>> discriminator on Company because it is abstract and should never be
>>> created, and therefore there are only Vendors or Customers.
>>>
>>> Our current ORM, when querying Companies, will generate
>>>     WHERE discriminator  = "Customer" or discriminator  = "Vendor"
>>>
>>> So, how do I fix this error?  If I put one in just to get rid of the
>>> error e.g. "Company", then the generated SQL on a query for Companies would
>>> not be as shown above would it?  it would be WHERE discriminator  =
>>> "Company" which will always return 0 zero results .
>>>
>>> How do I resolve this?
>>> Thanks in advance
>>>
>>> JAMES
>>>
>>>
>>>
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "nhusers" group.
>>> To view this discussion on the web visit https://groups.google.com/d/**
>>> msg/nhusers/-/BeyLz8t2mVAJ<https://groups.google.com/d/msg/nhusers/-/BeyLz8t2mVAJ>
>>> .
>>> To post to this group, send email to [email protected].
>>> To unsubscribe from this group, send email to nhusers+unsubscribe@**
>>> googlegroups.com.
>>> For more options, visit this group at http://groups.google.com/**
>>> group/nhusers?hl=en <http://groups.google.com/group/nhusers?hl=en>.
>>>
>>  --
> You received this message because you are subscribed to the Google Groups
> "nhusers" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/nhusers/-/Yt1H-H3DDgkJ.
> 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.
>

-- 
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.

Reply via email to