You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Scott Anderson <sa...@airvana.com> on 2008/04/12 05:02:05 UTC

Generalized DB editor

Hello,

I'm trying to write a generic editor for CayenneDataObjects. ObjAttributes are pretty straightforward, but I'm not clear on the best way to handle ObjRelationships. Basically, what I want to know is how to take a ObjRelationship and turn it in to a Class<? extends CayenneDataObjects> representing the target type's class.

http://bnubot.googlecode.com/svn/trunk/BNUBot/src/net/bnubot/bot/gui/DatabaseEditor.java

Thanks,
Scott

Re: Generalized DB editor

Posted by Andrus Adamchik <an...@objectstyle.org>.
On Apr 14, 2008, at 6:51 PM, Scott Anderson wrote:

> Looks like a cast to ObjEntity is in order. Out of curiosity, is  
> there a
> reason that ObjRelationship.getTargetEntity() returns an Entity and  
> not
> an ObjEntity? The JavaDoc seems to indicate it always returns an
> ObjEntity.

Poor choice of inheritance (ObjRelationship and DbRelationship both  
inherit from a common superclass).

Andrus


RE: Generalized DB editor

Posted by Scott Anderson <sa...@airvana.com>.
Looks like a cast to ObjEntity is in order. Out of curiosity, is there a
reason that ObjRelationship.getTargetEntity() returns an Entity and not
an ObjEntity? The JavaDoc seems to indicate it always returns an
ObjEntity.

-----Original Message-----
From: Kevin Menard [mailto:kmenard@servprise.com] 
Sent: Sunday, April 13, 2008 12:11 PM
To: user@cayenne.apache.org
Subject: Re: Generalized DB editor

Hi Scott,

Have you considered using getTargetEntity on ObjRelationship?

--  
Kevin

On Apr 11, 2008, at 11:02 PM, Scott Anderson wrote:

> Hello,
>
> I'm trying to write a generic editor for CayenneDataObjects.  
> ObjAttributes are pretty straightforward, but I'm not clear on the  
> best way to handle ObjRelationships. Basically, what I want to know  
> is how to take a ObjRelationship and turn it in to a Class<? extends  
> CayenneDataObjects> representing the target type's class.
>
>
http://bnubot.googlecode.com/svn/trunk/BNUBot/src/net/bnubot/bot/gui/Dat
abaseEditor.java
>
> Thanks,
> Scott


Re: Generalized DB editor

Posted by Kevin Menard <km...@servprise.com>.
Hi Scott,

Have you considered using getTargetEntity on ObjRelationship?

--  
Kevin

On Apr 11, 2008, at 11:02 PM, Scott Anderson wrote:

> Hello,
>
> I'm trying to write a generic editor for CayenneDataObjects.  
> ObjAttributes are pretty straightforward, but I'm not clear on the  
> best way to handle ObjRelationships. Basically, what I want to know  
> is how to take a ObjRelationship and turn it in to a Class<? extends  
> CayenneDataObjects> representing the target type's class.
>
> http://bnubot.googlecode.com/svn/trunk/BNUBot/src/net/bnubot/bot/gui/DatabaseEditor.java
>
> Thanks,
> Scott