Ok, but, can you tell me what the SQL generated is when querying for all Companies? Because if it is WHERE discriminator = -1" then we have a problem thanks JAMES
On Tuesday, January 8, 2013 12:58:48 PM UTC-6, Maximilian Haru Raditya wrote: > In my case, for the mapping of the base class, in your case Company, I set > the discriminator value -1, as I'm using enumeration. "-1" implies an > invalid value. > So, I think you can set it to whatever you want. > > > > On Wed, Jan 9, 2013 at 12:39 AM, James Klett <[email protected]<javascript:> > > 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]<javascript:> >> . >> To unsubscribe from this group, send email to >> [email protected] <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/nhusers?hl=en. >> > > > > -- > Regards, > > Maximilian Haru Raditya > -- 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/-/apMWLFZUJO4J. 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.
