On Aug 5, 2008, at 9:35 AM, Marcin Skladaniec wrote:

I think you are talking about VERTICAL inheritance, not horizontal here. In case of horizontal you wouldn't have a relationship between subclass/superclass tables. Anyways, assuming we are discussing vertical inheritance, yes, there is a relationship involved. Per JPA approach, this relationship can be figured automatically : it is a 1..1 relationship between the PK's of two tables. So we don't have to store it in XML, as we can find it in runtime. Still internally there should be a concept of a relationship joining parent and child tables, so you are right about the big picture.

I'm now confused with vertical-horizontal naming. You say vertical, jira https://issues.apache.org/cayenne/browse/CAY-795says horizontal. I guess we talk about the same thing anyway, but just to be sure: I'm trying to model a database schema where there are 3 tables: Artwork, Painting and Sculpture.
Artwork is an abstract entity with its own table
Painting and Sculpture are extending Artwork, but have their own tables as well. You are suggesting that both superclass and subclass should have PK, this means yet another table in required to link the two tables. This seems odd to me as the relationship is simple 1..1, is that a requirement of JPA ?
I'm reading up on JPA, but I cannot find it.

I guess CAY-795 is just not specific enough. It says "horizontal" in the title, but the steps to implement it are described in a rather generic fashion. Not sure if we have a separate Jira for vertical? Maybe Ari can open a new Jira on that.

Thanks,
Andrus

Reply via email to