I'm having difficulty trying to create a table-per-subclass
inheritance strategy using joined-subclass but leverage the primary
key of my child table rather than the base table.

I have two tables... Form (child table) and Publication (base table)
and they have the following schema (only including relevant columns
for simplicity):

Publication:
+ ID : bigint PK

Form
+ ID : bigint PK
+ PublicationID bigint FK

As you can see, while it is a one-to-one from Form to Publication
where Form.PublicationID = Publication.ID, Publication.ID does NOT
equal Form.ID as Form.ID is an identity column.

If I do a FormRepository.GetById(2) in my C# code, the SQL that
NHibernate generates is as such and not the desirable WHERE clause:

SELECT * FROM Form f inner join Publication p ON f.PublicationID =
p.ID WHERE f.PublicationID = 2;

What I would like it to be is

SELECT * FROM Form f inner join Publication p ON f.PublicationID =
p.ID WHERE f.ID = 2;

As I'm not deeply experienced in NHibernate, I was wondering if
someone knew of a solution for this or provide any insight into why
I'm experiencing this.

Thanks in advance!

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