Mapping a One-to-Many Relationship to One Object

I have the following tables in my database (just a demo, of course):

Positions

PositionId

Limitations

LimitId PositionId

I want them to join them into a single entity (there is always a position, not always attached to it):

Position

PositionId LimitId

I've seen articles dealing with one-to-one mapping and Table per inheritance type and tried to implement the same method here, but without sucess. Is it possible?

+1


a source to share


2 answers


I think what you want is a normal inner join where your foreign key (PositionID in Limits table) is resolved to null.



0


a source


Yes and no ... In my scenario, the second option is applicable since I don't have the same primary key in both tables. so I have to create an updatable view ... The problem with an updatable view is that I cannot change fields that are in different tables and expect the database to handle it unless I use the "Instead" triggers that I really I don't want to get involved at all ... So, I guess there is nothing for me because of me ... damn it. (Unless you have any other idea ...)



Anyway, I really thank you for your help, it is greatly appreciated. Nir.

0


a source







All Articles