Nhiberate, multiple tables, same class?

I think this has to do with polymorphism in N Try specifying polymorphism="explicit" on the mapping for your base-class (Invoice).

Very nice. Thanks – jeff Jun 11 '10 at 14:47.

If you don't want to retrieve the invoicehistory for an invoice inheritance wouldn't do the trick. Even creating an InvoiceBase would not help. If you are using inheritance nhibernate will always return the most complex object that exists in database.So if there is a foreign key in the invoicehistory pointing to an invoice you will alway get the invoicehistory object instead of a simple invoice.

This is a fundamental feature of nhibernate. You could excplicitly fetch only the properties of invoice and map them by hand using a ResultTransformer (see Reference for more infos) or create and map a SimpleInvoice object also referencing the invoice table, but with the latter you may face some stales-state issues is you mix Invoice and SimpleInvoice within the same session. Hope this helps.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions