Is it possible to get NHibernate to propagate properties that are generated by 
the database into child classes on save? The specific example I have is with 
these tables:

CREATE TABLE Parent
(
    Id INT IDENTITY(1,1) NOT NULL,
    ...
)

CREATE TABLE ChildA
(
    Id INT NOT NULL, -- Parent.Id
    AID INT IDENTITY(1, 1) NOT NULL,
    ...
)

CREATE TABLE ChildB
(
    Id INT NOT NULL, -- Parent.Id
    BID INT IDENTITY(1, 1) NOT NULL,
    ...
)

CREATE TABLE ChildAB
(
    Id INT NOT NULL, -- Parent.Id
    AID INT NOT NULL, -- ChildA.AID
    BID INT NOT NULL, -- ChildB.BID
    ...
)

I'm currently using a one-to-one mapping from Parent to ChildA and from Parent 
to ChildB with a foreign key generator and that is successfully propagating 
Parent.Id into ChildA and ChildB as expected. NHibernate is also picking up 
ChildA.AID and ChildB.BID with SELECT SCOPE_IDENTITY() correctly, but I can't 
figure out how to get AID and BID propagated into ChildAB.

If NHibernate can't do this on its own, is there a way to intercept the insert 
just before ChildAB is inserted to manually populate the AID and BID properties?

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