You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by MG...@escholar.com on 2010/05/05 20:04:25 UTC

Reverse engineering existing tables... selectively

Hey everybody,

        When I try to reverse engineer an existing table, I want to only 
reverse eng. a few of the tables that are related to each other.  The 
problem is that they are named differently.  When I put something like 
this in...

        "ETL_BATCH" OR "ETL_BATCH_CONFIG" OR "ETL_PARAM"

...nothing happens.  I've also tried with single and no quotes.  Is there 
a way to do this or is this not possible?  If I can't do it this way and I 
rev. eng. each table individually is there a way to have cayenne 
automatically figure out and create the relationships or do I need to do 
that by hand?

Thanks.
-Mike

Re: Reverse engineering existing tables... selectively

Posted by Andrus Adamchik <an...@objectstyle.org>.
Hi Mike,

Reverse engineering dialog does not support complex expressions, only  
patterns supported by DatabaseMetaData.getTables():

http://java.sun.com/j2se/1.5.0/docs/api/java/sql/DatabaseMetaData.html#getTables%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String 
[]%29

> If I can't do it this way and I
> rev. eng. each table individually is there a way to have cayenne
> automatically figure out and create the relationships or do I need  
> to do
> that by hand?

3.0 has a feature in the Modeler under Tools > Infer Relationships  
that can guess relationships if FK's follow naming convention  
"TARGETTABLENAME_ID". If they don't, relationships will have to be  
created manually.

Not sure if "Tools > Migrate Database Schema" may also help here:

http://cayenne.apache.org/doc30/migrate-changes-between-model-and-database.html

Andrus

On May 5, 2010, at 9:04 PM, MGargano@escholar.com wrote:

> Hey everybody,
>
>        When I try to reverse engineer an existing table, I want to  
> only
> reverse eng. a few of the tables that are related to each other.  The
> problem is that they are named differently.  When I put something like
> this in...
>
>        "ETL_BATCH" OR "ETL_BATCH_CONFIG" OR "ETL_PARAM"
>
> ...nothing happens.  I've also tried with single and no quotes.  Is  
> there
> a way to do this or is this not possible?  If I can't do it this way  
> and I
> rev. eng. each table individually is there a way to have cayenne
> automatically figure out and create the relationships or do I need  
> to do
> that by hand?
>
> Thanks.
> -Mike