You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by "Durchholz, Joachim" <Jo...@hennig-fahrzeugteile.de> on 2011/11/30 18:47:21 UTC

Table-per-class inheritance in Cayenne?

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

RE: Table-per-class inheritance in Cayenne?

Posted by "Durchholz, Joachim" <Jo...@hennig-fahrzeugteile.de>.
Thanks, I wasn't aware of that JIRA report.
I see Andrus has it on his radar for 3.1, that's good.

BTW the c2.com link is outdated, it's from 2007 and hence does not list Ebean.

Regards,
Jo

-----Original Message-----
From: gilbertoca [mailto:gilbertoca@gmail.com] 
Sent: Thursday, December 01, 2011 3:00 PM
To: user@cayenne.apache.org
Subject: Re: Table-per-class inheritance in Cayenne?

Hi jo,

Durchholz, Joachim 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?
> 
This issue is old[1]. Taking the Andrus' words "here you ran across something on the edges of Cayenne". I think some guys give up on  Apache Cayenne when they find it can't manage inheritance completely, so for some projects this is limitation (After all it is an ORM, isn't it?[2]). 
I've tried to introduce Cayenne in my work[3], but that limitation was the main reason it wasn't choose. 
So we are using JPA2 (eclipselink) in our projects.

Regards,

Gilberto

[1] https://issues.apache.org/jira/browse/CAY-795
[2] http://c2.com/cgi/wiki?ObjectRelationalToolComparison
[3] http://www.secad.to.gov.br


--
View this message in context: http://cayenne.195.n3.nabble.com/Table-per-class-inheritance-in-Cayenne-tp3549101p3551656.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: Table-per-class inheritance in Cayenne?

Posted by gilbertoca <gi...@gmail.com>.
Hi jo,

Durchholz, Joachim 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?
> 
This issue is old[1]. Taking the Andrus' words "here you ran across
something on the edges of Cayenne". I think some guys give up on  Apache
Cayenne when they find it can't manage inheritance completely, so for some
projects this is limitation (After all it is an ORM, isn't it?[2]). 
I've tried to introduce Cayenne in my work[3], but that limitation was the
main reason it wasn't choose. 
So we are using JPA2 (eclipselink) in our projects.

Regards,

Gilberto

[1] https://issues.apache.org/jira/browse/CAY-795
[2] http://c2.com/cgi/wiki?ObjectRelationalToolComparison
[3] http://www.secad.to.gov.br


--
View this message in context: http://cayenne.195.n3.nabble.com/Table-per-class-inheritance-in-Cayenne-tp3549101p3551656.html
Sent from the Cayenne - User mailing list archive at Nabble.com.

Re: Cayenne cache and external changes

Posted by Michael Gentry <mg...@masslight.net>.
Hi Marek,

Are you talking about saving or fetching?  On saving, optimistic
locking can help catch stale data issues.  On fetching, I always
prefer to go back to the DB and get fresh data (not use the cache).

mrg


On Wed, Nov 30, 2011 at 3:53 PM, Marek Šabo <ms...@buk.cvut.cz> wrote:
> Hi,
>
> my app that uses cayenne got few rows changed externally in mysql database.
> I observed that app didn't behave according to these changes and after
> restarting it worked as expected (with those changed rows). Could this be
> due to cayenne caching mechanism. Or is it probably bug on my side? If
> former, is it possible to set time expiration on cache, or invoke expiration
> manually?
>
> Thanks,
>
> Regards,
>
> Marek
>
> On 11/30/2011 06:47 PM, Durchholz, Joachim 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

Cayenne cache and external changes

Posted by Marek Šabo <ms...@buk.cvut.cz>.
Hi,

my app that uses cayenne got few rows changed externally in mysql 
database. I observed that app didn't behave according to these changes 
and after restarting it worked as expected (with those changed rows). 
Could this be due to cayenne caching mechanism. Or is it probably bug on 
my side? If former, is it possible to set time expiration on cache, or 
invoke expiration manually?

Thanks,

Regards,

Marek

On 11/30/2011 06:47 PM, Durchholz, Joachim 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

RE: Table-per-class inheritance in Cayenne?

Posted by "Durchholz, Joachim" <Jo...@hennig-fahrzeugteile.de>.
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 <Jo...@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

Re: Table-per-class inheritance in Cayenne?

Posted by Michael Gentry <mg...@masslight.net>.
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
<Jo...@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