cayenne-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Durchholz, Joachim" <Joachim.Durchh...@hennig-fahrzeugteile.de>
Subject RE: Table-per-class inheritance in Cayenne?
Date Mon, 05 Dec 2011 15:05:18 GMT
Hey, yes, Embeddables might do the trick.
It's all too easy to run into that "I need inheritance" trap, most of the time, you don't.
Suggestion: Add a paragraph explaining the alternatives to inheritance in the documentation.
I bet other people reading that page will miss that one, too.

Regards
Jo

-----Original Message-----
From: Michael Gentry [mailto:mgentry@masslight.net] 
Sent: Monday, December 05, 2011 3:26 PM
To: user@cayenne.apache.org
Subject: Re: Table-per-class inheritance in Cayenne?

Hi Joachim,

Is this something that Embeddables might could help out with?  Also, if you need to share
common methods, you can create your own abstract class that inherits from DataObject and then
in Cayenne Modeler, use the Superclass field for the ObjEntity to specify it.  When you generate
your classes, they'll inherit from whatever you specify.

mrg


On Wed, Nov 30, 2011 at 12:47 PM, Durchholz, Joachim <Joachim.Durchholz@hennig-fahrzeugteile.de>
wrote:
> On http://cayenne.apache.org/doc/modeling-inheritance.html , I see this statement:
> "As of this writing Cayenne does not support horizontal inheritance. It may in the future."
>
> Well, guess what, the first instance where I absolutely need inheritance does require
horizontal modeling. Two legacy tables happen to have a very similar column structure and
server very similar purposes, and since the processing is complicated and accesses many fields
of each record, having a common superclass wired up would really simplify a lot of code.
>
> So the question is: Is there any realistic hope that this will be done soon?
> Would outside help speed up things?
> Limited help, unfortunately. I'll have to justify any time I sink into 
> this :-(
>
> The other approach might be faking a vertical/joined scenario using views.
> However, I'd like to avoid that because I know that views tend to come with their own
cans of worms (updateability and lack of useful metadata).
>
> Regards,
> Jo

Mime
View raw message