You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@empire-db.apache.org by Rainer Döbele <do...@esteam.de> on 2011/06/29 12:30:44 UTC

re: Relationships

Hi everyone,

 

I think this is an important improvement of the code generator that we should implement.

I have created a Jira Issue for this:

 

https://issues.apache.org/jira/browse/EMPIREDB-110

 

Matt, if you feel you can and want to do It, then we would certainly appreciate this.

You may create a patch file and attach it to the JIRA ticket.

Then we can apply the patch and commit the code to svn.

 

For further discussion I would recommend to move to the dev-mailing list:

empire-db-dev@incubator.apache.org

 

Thanks, 

Rainer

 

 

Von: Benjamin Venditti [mailto:benjamin.venditti@arcor.de] 
Gesendet: Mittwoch, 29. Juni 2011 01:47
An: empire-db-user@incubator.apache.org
Cc: Matt DeHoust
Betreff: Re: Relationships

 

Hi Matt,

thanks for your interest in empire-db.

regarding your request ... unfortunately the codegen does not set up the relation of the database model.
At the moment the codegen will only set up views and tables. We thought these are the most important for the most people as they are usually sufficient for simple data access.

However i think there are two occasions where the relations are important:
    - database creation
    - deletion of records with cascading deletion enabled

At the moment we have not planned to add "relationship generation"  to the codegen component, but I am glad to hear that you consider to extend it on your own.

The right place to start with that would be:
    CodeGenParser.populateDatabase(..) : 131 : This is the point where the DatabaseMetaData is querried and used to populate empire-db's model
    CodeGenWriter.generateCodeFiles(..) : 125 : Is used to serialize the populated model as java code
    src/main/resources/Database.vm :  70 : This is the velocity template we use to create the java class for the database.
                                                                           In its default constructor you'd need to add a line for each relationship similar to this:

                                addRelation( EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));

I hope this is of some help to you. Feel free to ask if you have further questions!

Cherio
    Benjamin

Am 28.06.2011 19:37, schrieb Matt DeHoust: 

Hello, 

 

I see that the empire-db model supports relationships (for example DBDatabase.getRelations()), but it doesn't seem that the codegen component sets them up. Am I missing something? (I am using MySQL if that matters.)

 

If not, are there plans to introduce relationship setup in the codegen component?

 

If not, where should I look to add them myself? CodeGenParser?

 

Thanks,

Matt

 

P.S. I apologize if I posted this question twice by mitake.

 


Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi Matt,

i just took a deeper look into the generation of foreign-key 
relationships, and it doesn't seem to be too difficult.
Therefore i already started and finished the first of my suggested steps 
"querried the DatabaseMetaDate for relations and populate the empire db 
model".
I hope you don't mind that started with it. I think a first working 
version should be finished by this evening (within the next 3-4 hours).

I'd be glad if you could have a look at my code, maybe i missed something.

Cherio
     Benjamin


Am 29.06.2011 15:12, schrieb Matt DeHoust:
> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take
> a look at the code when I return from vacation and follow up using the dev
> list with any questions or ideas. I hope to have a chance to look into it
> this weekend.
>
> -Matt
>
> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>  wrote:
>
>> Hi everyone,****
>>
>> ** **
>>
>> I think this is an important improvement of the code generator that we
>> should implement.****
>>
>> I have created a Jira Issue for this:****
>>
>> ** **
>>
>> https://issues.apache.org/jira/browse/EMPIREDB-110****
>>
>> ** **
>>
>> Matt, if you feel you can and want to do It, then we would certainly
>> appreciate this.****
>>
>> You may create a patch file and attach it to the JIRA ticket.****
>>
>> Then we can apply the patch and commit the code to svn.****
>>
>> ** **
>>
>> For further discussion I would recommend to move to the dev-mailing list:*
>> ***
>>
>> empire-db-dev@incubator.apache.org****
>>
>> ** **
>>
>> Thanks, ****
>>
>> Rainer****
>>
>> ** **
>>
>> ** **
>>
>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>> *An:* empire-db-user@incubator.apache.org
>> *Cc:* Matt DeHoust
>> *Betreff:* Re: Relationships****
>>
>> ** **
>>
>> Hi Matt,
>>
>> thanks for your interest in empire-db.
>>
>> regarding your request ... unfortunately the codegen does not set up the
>> relation of the database model.
>> At the moment the codegen will only set up views and tables. We thought
>> these are the most important for the most people as they are usually
>> sufficient for simple data access.
>>
>> However i think there are two occasions where the relations are important:
>>      - database creation
>>      - deletion of records with cascading deletion enabled
>>
>> At the moment we have not planned to add "relationship generation"  to the
>> codegen component, but I am glad to hear that you consider to extend it on
>> your own.
>>
>> The right place to start with that would be:
>>     * CodeGenParser.populateDatabase(..) : 131* : This is the point where
>> the DatabaseMetaData is querried and used to populate empire-db's model
>>      *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize the
>> populated model as java code
>>      *src/main/resources/Database.vm :  70* : This is the velocity template
>> we use to create the java class for the database.
>>
>> In its default constructor you'd need to add a line for each relationship
>> similar to this:
>>
>>                                  *addRelation(
>> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>
>> I hope this is of some help to you. Feel free to ask if you have further
>> questions!
>>
>> Cherio
>>      Benjamin
>>
>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>
>> Hello, ****
>>
>> ** **
>>
>> I see that the empire-db model supports relationships (for example
>> DBDatabase.getRelations()), but it doesn't seem that the codegen component
>> sets them up. Am I missing something? (I am using MySQL if that matters.)*
>> ***
>>
>> ** **
>>
>> If not, are there plans to introduce relationship setup in the codegen
>> component?****
>>
>> ** **
>>
>> If not, where should I look to add them myself? CodeGenParser?****
>>
>> ** **
>>
>> Thanks,****
>>
>> Matt****
>>
>> ** **
>>
>> P.S. I apologize if I posted this question twice by mitake.****
>>
>> ** **
>>


EMPIREDB-110 patch

Posted by Rainer Döbele <do...@esteam.de>.
Dear Matt,

thank you very much for your patch for EMPIREDB-110.
I have checked-in your patch to our current svn code base.
Please apologize that it took us a few days.

Regards
Rainer

> from: Matt DeHoust [mailto:mdehoust@gmail.com]
> to: empire-db-dev@incubator.apache.org
> re: Re: Relationships
> 
> Also meant to say that I tested this with MySQL and, so far, it appears
> to
> work just fine. Thanks!
> 
> -Matt
> 
> On Mon, Jul 4, 2011 at 2:49 PM, Matt DeHoust <md...@gmail.com> wrote:
> 
> > Sorry for the delay, but I have attached the patch to EMPIREDB-110.
> The
> > patch provides a unit test named CodeGenParserTest that verifies the
> > EMPLOYEES->DEPARTMENTS relationship in the test database is properly
> reverse
> > engineered.
> >
> > -Matt
> >
> >
> > On Mon, Jul 4, 2011 at 8:05 AM, Benjamin Venditti <
> > benjamin.venditti@arcor.de> wrote:
> >
> >> Hi Rainer,
> >>
> >> good to hear they it is working as expected.
> >> I'll have another look at it when Matt attaches his test to this
> issue.
> >> It'd be good to have a formal testcase for that, too.
> >>
> >> Cherio
> >>    Benjamin
> >>
> >> Am 04.07.2011 11:25, schrieb Rainer Döbele:
> >>
> >>  Hi Benjamin,
> >>>
> >>> I had a look at your changes and they look good to me.
> >>> Tried it with Oracle and it worked as expected.
> >>>
> >>> I just made a few adjustments to the logging.
> >>>
> >>> Thanks a lot.
> >>> Rainer
> >>>
> >>>
> >>>  from: Benjamin Venditti
> [mailto:benjamin.venditti@**arcor.de<be...@arcor.de>
> >>>> ]
> >>>> to: empire-db-dev@incubator.**apache.org<empire-db-
> dev@incubator.apache.org>
> >>>> cc: Matt DeHoust; empire-db-user@incubator.**apache.org<empire-db-
> user@incubator.apache.org>
> >>>> re: Re: Relationships
> >>>>
> >>>> Hi there,
> >>>>
> >>>> i just committed a working solution for EMPIREDB-110 the
> >>>> reverse-engineering of foreign-key relationships.
> >>>> i'd be happy if anyone could have a look at it.
> >>>>
> >>>> Cherio
> >>>>      Benjamin
> >>>>
> >>>> Am 29.06.2011 15:12, schrieb Matt DeHoust:
> >>>>
> >>>>> Thank you Benjamin and Rainer. I have subscribed to the dev list.
> I'll
> >>>>>
> >>>> take
> >>>>
> >>>>> a look at the code when I return from vacation and follow up using
> the
> >>>>>
> >>>> dev
> >>>>
> >>>>> list with any questions or ideas. I hope to have a chance to look
> into
> >>>>>
> >>>> it
> >>>>
> >>>>> this weekend.
> >>>>>
> >>>>> -Matt
> >>>>>
> >>>>> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>
> >>>>>
> >>>> wrote:
> >>>>
> >>>>> Hi everyone,****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> I think this is an important improvement of the code generator
> that
> >>>>>>
> >>>>> we
> >>>>
> >>>>> should implement.****
> >>>>>>
> >>>>>> I have created a Jira Issue for this:****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> https://issues.apache.org/**jira/browse/EMPIREDB-
> 110****<https://issues.apache.org/jira/browse/EMPIREDB-110****>
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> Matt, if you feel you can and want to do It, then we would
> certainly
> >>>>>> appreciate this.****
> >>>>>>
> >>>>>> You may create a patch file and attach it to the JIRA ticket.****
> >>>>>>
> >>>>>> Then we can apply the patch and commit the code to svn.****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> For further discussion I would recommend to move to the dev-
> mailing
> >>>>>>
> >>>>> list:*
> >>>>
> >>>>> ***
> >>>>>>
> >>>>>> empire-db-dev@incubator.**apache.org<empire-db-
> dev@incubator.apache.org>
> >>>>>> ****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> Thanks, ****
> >>>>>>
> >>>>>> Rainer****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> *Von:* Benjamin Venditti
> [mailto:benjamin.venditti@**arcor.de<be...@arcor.de>
> >>>>>> ]
> >>>>>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
> >>>>>> *An:* empire-db-user@incubator.**apache.org<empire-db-
> user@incubator.apache.org>
> >>>>>> *Cc:* Matt DeHoust
> >>>>>> *Betreff:* Re: Relationships****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> Hi Matt,
> >>>>>>
> >>>>>> thanks for your interest in empire-db.
> >>>>>>
> >>>>>> regarding your request ... unfortunately the codegen does not set
> up
> >>>>>>
> >>>>> the
> >>>>
> >>>>> relation of the database model.
> >>>>>> At the moment the codegen will only set up views and tables. We
> >>>>>>
> >>>>> thought
> >>>>
> >>>>> these are the most important for the most people as they are
> usually
> >>>>>> sufficient for simple data access.
> >>>>>>
> >>>>>> However i think there are two occasions where the relations are
> >>>>>>
> >>>>> important:
> >>>>
> >>>>>      - database creation
> >>>>>>      - deletion of records with cascading deletion enabled
> >>>>>>
> >>>>>> At the moment we have not planned to add "relationship
> generation"
> >>>>>>
> >>>>> to the
> >>>>
> >>>>> codegen component, but I am glad to hear that you consider to
> extend
> >>>>>>
> >>>>> it on
> >>>>
> >>>>> your own.
> >>>>>>
> >>>>>> The right place to start with that would be:
> >>>>>>     * CodeGenParser.**populateDatabase(..) : 131* : This is the
> point
> >>>>>>
> >>>>> where
> >>>>
> >>>>> the DatabaseMetaData is querried and used to populate empire-db's
> >>>>>>
> >>>>> model
> >>>>
> >>>>>      *CodeGenWriter.**generateCodeFiles(..) : 125* : Is used to
> >>>>>>
> >>>>> serialize the
> >>>>
> >>>>> populated model as java code
> >>>>>>      *src/main/resources/Database.**vm :  70* : This is the
> velocity
> >>>>>>
> >>>>> template
> >>>>
> >>>>> we use to create the java class for the database.
> >>>>>>
> >>>>>> In its default constructor you'd need to add a line for each
> >>>>>>
> >>>>> relationship
> >>>>
> >>>>> similar to this:
> >>>>>>
> >>>>>>                                  *addRelation(
> >>>>>> EMPLOYEES.DEPARTMENT_ID.**referenceOn( DEPARTMENTS.DEPARTMENT_ID
> ));*
> >>>>>>
> >>>>>> I hope this is of some help to you. Feel free to ask if you have
> >>>>>>
> >>>>> further
> >>>>
> >>>>> questions!
> >>>>>>
> >>>>>> Cherio
> >>>>>>      Benjamin
> >>>>>>
> >>>>>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
> >>>>>>
> >>>>>> Hello, ****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> I see that the empire-db model supports relationships (for
> example
> >>>>>> DBDatabase.getRelations()), but it doesn't seem that the codegen
> >>>>>>
> >>>>> component
> >>>>
> >>>>> sets them up. Am I missing something? (I am using MySQL if that
> >>>>>>
> >>>>> matters.)*
> >>>>
> >>>>> ***
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> If not, are there plans to introduce relationship setup in the
> >>>>>>
> >>>>> codegen
> >>>>
> >>>>> component?****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> If not, where should I look to add them myself?
> CodeGenParser?****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> Thanks,****
> >>>>>>
> >>>>>> Matt****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>> P.S. I apologize if I posted this question twice by mitake.****
> >>>>>>
> >>>>>> ** **
> >>>>>>
> >>>>>>
> >>
> >

Re: Relationships

Posted by Matt DeHoust <md...@gmail.com>.
Also meant to say that I tested this with MySQL and, so far, it appears to
work just fine. Thanks!

-Matt

On Mon, Jul 4, 2011 at 2:49 PM, Matt DeHoust <md...@gmail.com> wrote:

> Sorry for the delay, but I have attached the patch to EMPIREDB-110. The
> patch provides a unit test named CodeGenParserTest that verifies the
> EMPLOYEES->DEPARTMENTS relationship in the test database is properly reverse
> engineered.
>
> -Matt
>
>
> On Mon, Jul 4, 2011 at 8:05 AM, Benjamin Venditti <
> benjamin.venditti@arcor.de> wrote:
>
>> Hi Rainer,
>>
>> good to hear they it is working as expected.
>> I'll have another look at it when Matt attaches his test to this issue.
>> It'd be good to have a formal testcase for that, too.
>>
>> Cherio
>>    Benjamin
>>
>> Am 04.07.2011 11:25, schrieb Rainer Döbele:
>>
>>  Hi Benjamin,
>>>
>>> I had a look at your changes and they look good to me.
>>> Tried it with Oracle and it worked as expected.
>>>
>>> I just made a few adjustments to the logging.
>>>
>>> Thanks a lot.
>>> Rainer
>>>
>>>
>>>  from: Benjamin Venditti [mailto:benjamin.venditti@**arcor.de<be...@arcor.de>
>>>> ]
>>>> to: empire-db-dev@incubator.**apache.org<em...@incubator.apache.org>
>>>> cc: Matt DeHoust; empire-db-user@incubator.**apache.org<em...@incubator.apache.org>
>>>> re: Re: Relationships
>>>>
>>>> Hi there,
>>>>
>>>> i just committed a working solution for EMPIREDB-110 the
>>>> reverse-engineering of foreign-key relationships.
>>>> i'd be happy if anyone could have a look at it.
>>>>
>>>> Cherio
>>>>      Benjamin
>>>>
>>>> Am 29.06.2011 15:12, schrieb Matt DeHoust:
>>>>
>>>>> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll
>>>>>
>>>> take
>>>>
>>>>> a look at the code when I return from vacation and follow up using the
>>>>>
>>>> dev
>>>>
>>>>> list with any questions or ideas. I hope to have a chance to look into
>>>>>
>>>> it
>>>>
>>>>> this weekend.
>>>>>
>>>>> -Matt
>>>>>
>>>>> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>
>>>>>
>>>> wrote:
>>>>
>>>>> Hi everyone,****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> I think this is an important improvement of the code generator that
>>>>>>
>>>>> we
>>>>
>>>>> should implement.****
>>>>>>
>>>>>> I have created a Jira Issue for this:****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> https://issues.apache.org/**jira/browse/EMPIREDB-110****<https://issues.apache.org/jira/browse/EMPIREDB-110****>
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> Matt, if you feel you can and want to do It, then we would certainly
>>>>>> appreciate this.****
>>>>>>
>>>>>> You may create a patch file and attach it to the JIRA ticket.****
>>>>>>
>>>>>> Then we can apply the patch and commit the code to svn.****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> For further discussion I would recommend to move to the dev-mailing
>>>>>>
>>>>> list:*
>>>>
>>>>> ***
>>>>>>
>>>>>> empire-db-dev@incubator.**apache.org<em...@incubator.apache.org>
>>>>>> ****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> Thanks, ****
>>>>>>
>>>>>> Rainer****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@**arcor.de<be...@arcor.de>
>>>>>> ]
>>>>>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>>>>>> *An:* empire-db-user@incubator.**apache.org<em...@incubator.apache.org>
>>>>>> *Cc:* Matt DeHoust
>>>>>> *Betreff:* Re: Relationships****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> Hi Matt,
>>>>>>
>>>>>> thanks for your interest in empire-db.
>>>>>>
>>>>>> regarding your request ... unfortunately the codegen does not set up
>>>>>>
>>>>> the
>>>>
>>>>> relation of the database model.
>>>>>> At the moment the codegen will only set up views and tables. We
>>>>>>
>>>>> thought
>>>>
>>>>> these are the most important for the most people as they are usually
>>>>>> sufficient for simple data access.
>>>>>>
>>>>>> However i think there are two occasions where the relations are
>>>>>>
>>>>> important:
>>>>
>>>>>      - database creation
>>>>>>      - deletion of records with cascading deletion enabled
>>>>>>
>>>>>> At the moment we have not planned to add "relationship generation"
>>>>>>
>>>>> to the
>>>>
>>>>> codegen component, but I am glad to hear that you consider to extend
>>>>>>
>>>>> it on
>>>>
>>>>> your own.
>>>>>>
>>>>>> The right place to start with that would be:
>>>>>>     * CodeGenParser.**populateDatabase(..) : 131* : This is the point
>>>>>>
>>>>> where
>>>>
>>>>> the DatabaseMetaData is querried and used to populate empire-db's
>>>>>>
>>>>> model
>>>>
>>>>>      *CodeGenWriter.**generateCodeFiles(..) : 125* : Is used to
>>>>>>
>>>>> serialize the
>>>>
>>>>> populated model as java code
>>>>>>      *src/main/resources/Database.**vm :  70* : This is the velocity
>>>>>>
>>>>> template
>>>>
>>>>> we use to create the java class for the database.
>>>>>>
>>>>>> In its default constructor you'd need to add a line for each
>>>>>>
>>>>> relationship
>>>>
>>>>> similar to this:
>>>>>>
>>>>>>                                  *addRelation(
>>>>>> EMPLOYEES.DEPARTMENT_ID.**referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>>>>>
>>>>>> I hope this is of some help to you. Feel free to ask if you have
>>>>>>
>>>>> further
>>>>
>>>>> questions!
>>>>>>
>>>>>> Cherio
>>>>>>      Benjamin
>>>>>>
>>>>>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>>>>>
>>>>>> Hello, ****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> I see that the empire-db model supports relationships (for example
>>>>>> DBDatabase.getRelations()), but it doesn't seem that the codegen
>>>>>>
>>>>> component
>>>>
>>>>> sets them up. Am I missing something? (I am using MySQL if that
>>>>>>
>>>>> matters.)*
>>>>
>>>>> ***
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> If not, are there plans to introduce relationship setup in the
>>>>>>
>>>>> codegen
>>>>
>>>>> component?****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> If not, where should I look to add them myself? CodeGenParser?****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> Thanks,****
>>>>>>
>>>>>> Matt****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>> P.S. I apologize if I posted this question twice by mitake.****
>>>>>>
>>>>>> ** **
>>>>>>
>>>>>>
>>
>

Re: Relationships

Posted by Matt DeHoust <md...@gmail.com>.
Sorry for the delay, but I have attached the patch to EMPIREDB-110. The
patch provides a unit test named CodeGenParserTest that verifies the
EMPLOYEES->DEPARTMENTS relationship in the test database is properly reverse
engineered.

-Matt


On Mon, Jul 4, 2011 at 8:05 AM, Benjamin Venditti <
benjamin.venditti@arcor.de> wrote:

> Hi Rainer,
>
> good to hear they it is working as expected.
> I'll have another look at it when Matt attaches his test to this issue.
> It'd be good to have a formal testcase for that, too.
>
> Cherio
>    Benjamin
>
> Am 04.07.2011 11:25, schrieb Rainer Döbele:
>
>  Hi Benjamin,
>>
>> I had a look at your changes and they look good to me.
>> Tried it with Oracle and it worked as expected.
>>
>> I just made a few adjustments to the logging.
>>
>> Thanks a lot.
>> Rainer
>>
>>
>>  from: Benjamin Venditti [mailto:benjamin.venditti@**arcor.de<be...@arcor.de>
>>> ]
>>> to: empire-db-dev@incubator.**apache.org<em...@incubator.apache.org>
>>> cc: Matt DeHoust; empire-db-user@incubator.**apache.org<em...@incubator.apache.org>
>>> re: Re: Relationships
>>>
>>> Hi there,
>>>
>>> i just committed a working solution for EMPIREDB-110 the
>>> reverse-engineering of foreign-key relationships.
>>> i'd be happy if anyone could have a look at it.
>>>
>>> Cherio
>>>      Benjamin
>>>
>>> Am 29.06.2011 15:12, schrieb Matt DeHoust:
>>>
>>>> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll
>>>>
>>> take
>>>
>>>> a look at the code when I return from vacation and follow up using the
>>>>
>>> dev
>>>
>>>> list with any questions or ideas. I hope to have a chance to look into
>>>>
>>> it
>>>
>>>> this weekend.
>>>>
>>>> -Matt
>>>>
>>>> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>
>>>>
>>> wrote:
>>>
>>>> Hi everyone,****
>>>>>
>>>>> ** **
>>>>>
>>>>> I think this is an important improvement of the code generator that
>>>>>
>>>> we
>>>
>>>> should implement.****
>>>>>
>>>>> I have created a Jira Issue for this:****
>>>>>
>>>>> ** **
>>>>>
>>>>> https://issues.apache.org/**jira/browse/EMPIREDB-110****<https://issues.apache.org/jira/browse/EMPIREDB-110****>
>>>>>
>>>>> ** **
>>>>>
>>>>> Matt, if you feel you can and want to do It, then we would certainly
>>>>> appreciate this.****
>>>>>
>>>>> You may create a patch file and attach it to the JIRA ticket.****
>>>>>
>>>>> Then we can apply the patch and commit the code to svn.****
>>>>>
>>>>> ** **
>>>>>
>>>>> For further discussion I would recommend to move to the dev-mailing
>>>>>
>>>> list:*
>>>
>>>> ***
>>>>>
>>>>> empire-db-dev@incubator.**apache.org<em...@incubator.apache.org>
>>>>> ****
>>>>>
>>>>> ** **
>>>>>
>>>>> Thanks, ****
>>>>>
>>>>> Rainer****
>>>>>
>>>>> ** **
>>>>>
>>>>> ** **
>>>>>
>>>>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@**arcor.de<be...@arcor.de>
>>>>> ]
>>>>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>>>>> *An:* empire-db-user@incubator.**apache.org<em...@incubator.apache.org>
>>>>> *Cc:* Matt DeHoust
>>>>> *Betreff:* Re: Relationships****
>>>>>
>>>>> ** **
>>>>>
>>>>> Hi Matt,
>>>>>
>>>>> thanks for your interest in empire-db.
>>>>>
>>>>> regarding your request ... unfortunately the codegen does not set up
>>>>>
>>>> the
>>>
>>>> relation of the database model.
>>>>> At the moment the codegen will only set up views and tables. We
>>>>>
>>>> thought
>>>
>>>> these are the most important for the most people as they are usually
>>>>> sufficient for simple data access.
>>>>>
>>>>> However i think there are two occasions where the relations are
>>>>>
>>>> important:
>>>
>>>>      - database creation
>>>>>      - deletion of records with cascading deletion enabled
>>>>>
>>>>> At the moment we have not planned to add "relationship generation"
>>>>>
>>>> to the
>>>
>>>> codegen component, but I am glad to hear that you consider to extend
>>>>>
>>>> it on
>>>
>>>> your own.
>>>>>
>>>>> The right place to start with that would be:
>>>>>     * CodeGenParser.**populateDatabase(..) : 131* : This is the point
>>>>>
>>>> where
>>>
>>>> the DatabaseMetaData is querried and used to populate empire-db's
>>>>>
>>>> model
>>>
>>>>      *CodeGenWriter.**generateCodeFiles(..) : 125* : Is used to
>>>>>
>>>> serialize the
>>>
>>>> populated model as java code
>>>>>      *src/main/resources/Database.**vm :  70* : This is the velocity
>>>>>
>>>> template
>>>
>>>> we use to create the java class for the database.
>>>>>
>>>>> In its default constructor you'd need to add a line for each
>>>>>
>>>> relationship
>>>
>>>> similar to this:
>>>>>
>>>>>                                  *addRelation(
>>>>> EMPLOYEES.DEPARTMENT_ID.**referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>>>>
>>>>> I hope this is of some help to you. Feel free to ask if you have
>>>>>
>>>> further
>>>
>>>> questions!
>>>>>
>>>>> Cherio
>>>>>      Benjamin
>>>>>
>>>>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>>>>
>>>>> Hello, ****
>>>>>
>>>>> ** **
>>>>>
>>>>> I see that the empire-db model supports relationships (for example
>>>>> DBDatabase.getRelations()), but it doesn't seem that the codegen
>>>>>
>>>> component
>>>
>>>> sets them up. Am I missing something? (I am using MySQL if that
>>>>>
>>>> matters.)*
>>>
>>>> ***
>>>>>
>>>>> ** **
>>>>>
>>>>> If not, are there plans to introduce relationship setup in the
>>>>>
>>>> codegen
>>>
>>>> component?****
>>>>>
>>>>> ** **
>>>>>
>>>>> If not, where should I look to add them myself? CodeGenParser?****
>>>>>
>>>>> ** **
>>>>>
>>>>> Thanks,****
>>>>>
>>>>> Matt****
>>>>>
>>>>> ** **
>>>>>
>>>>> P.S. I apologize if I posted this question twice by mitake.****
>>>>>
>>>>> ** **
>>>>>
>>>>>
>

Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi Rainer,

good to hear they it is working as expected.
I'll have another look at it when Matt attaches his test to this issue.
It'd be good to have a formal testcase for that, too.

Cherio
     Benjamin

Am 04.07.2011 11:25, schrieb Rainer Döbele:
> Hi Benjamin,
>
> I had a look at your changes and they look good to me.
> Tried it with Oracle and it worked as expected.
>
> I just made a few adjustments to the logging.
>
> Thanks a lot.
> Rainer
>
>
>> from: Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
>> to: empire-db-dev@incubator.apache.org
>> cc: Matt DeHoust; empire-db-user@incubator.apache.org
>> re: Re: Relationships
>>
>> Hi there,
>>
>> i just committed a working solution for EMPIREDB-110 the
>> reverse-engineering of foreign-key relationships.
>> i'd be happy if anyone could have a look at it.
>>
>> Cherio
>>       Benjamin
>>
>> Am 29.06.2011 15:12, schrieb Matt DeHoust:
>>> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll
>> take
>>> a look at the code when I return from vacation and follow up using the
>> dev
>>> list with any questions or ideas. I hope to have a chance to look into
>> it
>>> this weekend.
>>>
>>> -Matt
>>>
>>> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>
>> wrote:
>>>> Hi everyone,****
>>>>
>>>> ** **
>>>>
>>>> I think this is an important improvement of the code generator that
>> we
>>>> should implement.****
>>>>
>>>> I have created a Jira Issue for this:****
>>>>
>>>> ** **
>>>>
>>>> https://issues.apache.org/jira/browse/EMPIREDB-110****
>>>>
>>>> ** **
>>>>
>>>> Matt, if you feel you can and want to do It, then we would certainly
>>>> appreciate this.****
>>>>
>>>> You may create a patch file and attach it to the JIRA ticket.****
>>>>
>>>> Then we can apply the patch and commit the code to svn.****
>>>>
>>>> ** **
>>>>
>>>> For further discussion I would recommend to move to the dev-mailing
>> list:*
>>>> ***
>>>>
>>>> empire-db-dev@incubator.apache.org****
>>>>
>>>> ** **
>>>>
>>>> Thanks, ****
>>>>
>>>> Rainer****
>>>>
>>>> ** **
>>>>
>>>> ** **
>>>>
>>>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
>>>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>>>> *An:* empire-db-user@incubator.apache.org
>>>> *Cc:* Matt DeHoust
>>>> *Betreff:* Re: Relationships****
>>>>
>>>> ** **
>>>>
>>>> Hi Matt,
>>>>
>>>> thanks for your interest in empire-db.
>>>>
>>>> regarding your request ... unfortunately the codegen does not set up
>> the
>>>> relation of the database model.
>>>> At the moment the codegen will only set up views and tables. We
>> thought
>>>> these are the most important for the most people as they are usually
>>>> sufficient for simple data access.
>>>>
>>>> However i think there are two occasions where the relations are
>> important:
>>>>       - database creation
>>>>       - deletion of records with cascading deletion enabled
>>>>
>>>> At the moment we have not planned to add "relationship generation"
>> to the
>>>> codegen component, but I am glad to hear that you consider to extend
>> it on
>>>> your own.
>>>>
>>>> The right place to start with that would be:
>>>>      * CodeGenParser.populateDatabase(..) : 131* : This is the point
>> where
>>>> the DatabaseMetaData is querried and used to populate empire-db's
>> model
>>>>       *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to
>> serialize the
>>>> populated model as java code
>>>>       *src/main/resources/Database.vm :  70* : This is the velocity
>> template
>>>> we use to create the java class for the database.
>>>>
>>>> In its default constructor you'd need to add a line for each
>> relationship
>>>> similar to this:
>>>>
>>>>                                   *addRelation(
>>>> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>>>
>>>> I hope this is of some help to you. Feel free to ask if you have
>> further
>>>> questions!
>>>>
>>>> Cherio
>>>>       Benjamin
>>>>
>>>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>>>
>>>> Hello, ****
>>>>
>>>> ** **
>>>>
>>>> I see that the empire-db model supports relationships (for example
>>>> DBDatabase.getRelations()), but it doesn't seem that the codegen
>> component
>>>> sets them up. Am I missing something? (I am using MySQL if that
>> matters.)*
>>>> ***
>>>>
>>>> ** **
>>>>
>>>> If not, are there plans to introduce relationship setup in the
>> codegen
>>>> component?****
>>>>
>>>> ** **
>>>>
>>>> If not, where should I look to add them myself? CodeGenParser?****
>>>>
>>>> ** **
>>>>
>>>> Thanks,****
>>>>
>>>> Matt****
>>>>
>>>> ** **
>>>>
>>>> P.S. I apologize if I posted this question twice by mitake.****
>>>>
>>>> ** **
>>>>


re: Relationships

Posted by Rainer Döbele <do...@esteam.de>.
Hi Benjamin,

I had a look at your changes and they look good to me.
Tried it with Oracle and it worked as expected.

I just made a few adjustments to the logging.

Thanks a lot.
Rainer


> from: Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
> to: empire-db-dev@incubator.apache.org
> cc: Matt DeHoust; empire-db-user@incubator.apache.org
> re: Re: Relationships
> 
> Hi there,
> 
> i just committed a working solution for EMPIREDB-110 the
> reverse-engineering of foreign-key relationships.
> i'd be happy if anyone could have a look at it.
> 
> Cherio
>      Benjamin
> 
> Am 29.06.2011 15:12, schrieb Matt DeHoust:
> > Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll
> take
> > a look at the code when I return from vacation and follow up using the
> dev
> > list with any questions or ideas. I hope to have a chance to look into
> it
> > this weekend.
> >
> > -Matt
> >
> > On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>
> wrote:
> >
> >> Hi everyone,****
> >>
> >> ** **
> >>
> >> I think this is an important improvement of the code generator that
> we
> >> should implement.****
> >>
> >> I have created a Jira Issue for this:****
> >>
> >> ** **
> >>
> >> https://issues.apache.org/jira/browse/EMPIREDB-110****
> >>
> >> ** **
> >>
> >> Matt, if you feel you can and want to do It, then we would certainly
> >> appreciate this.****
> >>
> >> You may create a patch file and attach it to the JIRA ticket.****
> >>
> >> Then we can apply the patch and commit the code to svn.****
> >>
> >> ** **
> >>
> >> For further discussion I would recommend to move to the dev-mailing
> list:*
> >> ***
> >>
> >> empire-db-dev@incubator.apache.org****
> >>
> >> ** **
> >>
> >> Thanks, ****
> >>
> >> Rainer****
> >>
> >> ** **
> >>
> >> ** **
> >>
> >> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
> >> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
> >> *An:* empire-db-user@incubator.apache.org
> >> *Cc:* Matt DeHoust
> >> *Betreff:* Re: Relationships****
> >>
> >> ** **
> >>
> >> Hi Matt,
> >>
> >> thanks for your interest in empire-db.
> >>
> >> regarding your request ... unfortunately the codegen does not set up
> the
> >> relation of the database model.
> >> At the moment the codegen will only set up views and tables. We
> thought
> >> these are the most important for the most people as they are usually
> >> sufficient for simple data access.
> >>
> >> However i think there are two occasions where the relations are
> important:
> >>      - database creation
> >>      - deletion of records with cascading deletion enabled
> >>
> >> At the moment we have not planned to add "relationship generation"
> to the
> >> codegen component, but I am glad to hear that you consider to extend
> it on
> >> your own.
> >>
> >> The right place to start with that would be:
> >>     * CodeGenParser.populateDatabase(..) : 131* : This is the point
> where
> >> the DatabaseMetaData is querried and used to populate empire-db's
> model
> >>      *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to
> serialize the
> >> populated model as java code
> >>      *src/main/resources/Database.vm :  70* : This is the velocity
> template
> >> we use to create the java class for the database.
> >>
> >> In its default constructor you'd need to add a line for each
> relationship
> >> similar to this:
> >>
> >>                                  *addRelation(
> >> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
> >>
> >> I hope this is of some help to you. Feel free to ask if you have
> further
> >> questions!
> >>
> >> Cherio
> >>      Benjamin
> >>
> >> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
> >>
> >> Hello, ****
> >>
> >> ** **
> >>
> >> I see that the empire-db model supports relationships (for example
> >> DBDatabase.getRelations()), but it doesn't seem that the codegen
> component
> >> sets them up. Am I missing something? (I am using MySQL if that
> matters.)*
> >> ***
> >>
> >> ** **
> >>
> >> If not, are there plans to introduce relationship setup in the
> codegen
> >> component?****
> >>
> >> ** **
> >>
> >> If not, where should I look to add them myself? CodeGenParser?****
> >>
> >> ** **
> >>
> >> Thanks,****
> >>
> >> Matt****
> >>
> >> ** **
> >>
> >> P.S. I apologize if I posted this question twice by mitake.****
> >>
> >> ** **
> >>


Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi Matt,
your testcases will surely be valuable, as i havn't tested my code 
programatically!
I'll have a look at the test cases when you supply them.

Cherio
     Benjamin

Am 02.07.2011 23:11, schrieb Matt DeHoust:
> Benjamin,
>
> I had started implementing this feature myself before I saw your 
> message. The good news is the test case I wrote passes with your 
> implementation. If you'd like to add the test to the code base, I'd be 
> happy to attach a patch to the issue.
>
> I'm going to give it a try against MySQL using the maven plugin. I'll 
> let you know how it goes.
>
> Thanks,
> Matt
>
> On Sat, Jul 2, 2011 at 12:36 PM, Benjamin Venditti 
> <benjamin.venditti@arcor.de <ma...@arcor.de>> wrote:
>
>     Hi there,
>
>     i just committed a working solution for EMPIREDB-110 the
>     reverse-engineering of foreign-key relationships.
>     i'd be happy if anyone could have a look at it.
>
>
>     Cherio
>        Benjamin
>
>     Am 29.06.2011 15:12, schrieb Matt DeHoust:
>
>         Thank you Benjamin and Rainer. I have subscribed to the dev
>         list. I'll take
>
>         a look at the code when I return from vacation and follow up
>         using the dev
>         list with any questions or ideas. I hope to have a chance to
>         look into it
>         this weekend.
>
>         -Matt
>
>         On Wed, Jun 29, 2011 at 6:30 AM, Rainer
>         Döbele<doebele@esteam.de <ma...@esteam.de>>  wrote:
>
>             Hi everyone,****
>
>             ** **
>
>             I think this is an important improvement of the code
>             generator that we
>             should implement.****
>
>             I have created a Jira Issue for this:****
>
>             ** **
>
>             https://issues.apache.org/jira/browse/EMPIREDB-110****
>
>             ** **
>
>             Matt, if you feel you can and want to do It, then we would
>             certainly
>             appreciate this.****
>
>             You may create a patch file and attach it to the JIRA
>             ticket.****
>
>             Then we can apply the patch and commit the code to svn.****
>
>             ** **
>
>             For further discussion I would recommend to move to the
>             dev-mailing list:*
>             ***
>
>             empire-db-dev@incubator.apache.org
>             <ma...@incubator.apache.org>****
>
>             ** **
>
>             Thanks, ****
>
>             Rainer****
>
>             ** **
>
>             ** **
>
>             *Von:* Benjamin Venditti
>             [mailto:benjamin.venditti@arcor.de
>             <ma...@arcor.de>]
>             *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>             *An:* empire-db-user@incubator.apache.org
>             <ma...@incubator.apache.org>
>             *Cc:* Matt DeHoust
>             *Betreff:* Re: Relationships****
>
>             ** **
>
>             Hi Matt,
>
>             thanks for your interest in empire-db.
>
>             regarding your request ... unfortunately the codegen does
>             not set up the
>             relation of the database model.
>             At the moment the codegen will only set up views and
>             tables. We thought
>             these are the most important for the most people as they
>             are usually
>             sufficient for simple data access.
>
>             However i think there are two occasions where the
>             relations are important:
>                 - database creation
>                 - deletion of records with cascading deletion enabled
>
>             At the moment we have not planned to add "relationship
>             generation"  to the
>             codegen component, but I am glad to hear that you consider
>             to extend it on
>             your own.
>
>             The right place to start with that would be:
>                * CodeGenParser.populateDatabase(..) : 131* : This is
>             the point where
>             the DatabaseMetaData is querried and used to populate
>             empire-db's model
>                 *CodeGenWriter.generateCodeFiles(..) : 125* : Is used
>             to serialize the
>             populated model as java code
>                 *src/main/resources/Database.vm :  70* : This is the
>             velocity template
>             we use to create the java class for the database.
>
>             In its default constructor you'd need to add a line for
>             each relationship
>             similar to this:
>
>                                             *addRelation(
>             EMPLOYEES.DEPARTMENT_ID.referenceOn(
>             DEPARTMENTS.DEPARTMENT_ID ));*
>
>             I hope this is of some help to you. Feel free to ask if
>             you have further
>             questions!
>
>             Cherio
>                 Benjamin
>
>             Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>
>             Hello, ****
>
>             ** **
>
>             I see that the empire-db model supports relationships (for
>             example
>             DBDatabase.getRelations()), but it doesn't seem that the
>             codegen component
>             sets them up. Am I missing something? (I am using MySQL if
>             that matters.)*
>             ***
>
>             ** **
>
>             If not, are there plans to introduce relationship setup in
>             the codegen
>             component?****
>
>             ** **
>
>             If not, where should I look to add them myself?
>             CodeGenParser?****
>
>             ** **
>
>             Thanks,****
>
>             Matt****
>
>             ** **
>
>             P.S. I apologize if I posted this question twice by
>             mitake.****
>
>             ** **
>
>
>


Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi Matt,
your testcases will surely be valuable, as i havn't tested my code 
programatically!
I'll have a look at the test cases when you supply them.

Cherio
     Benjamin

Am 02.07.2011 23:11, schrieb Matt DeHoust:
> Benjamin,
>
> I had started implementing this feature myself before I saw your 
> message. The good news is the test case I wrote passes with your 
> implementation. If you'd like to add the test to the code base, I'd be 
> happy to attach a patch to the issue.
>
> I'm going to give it a try against MySQL using the maven plugin. I'll 
> let you know how it goes.
>
> Thanks,
> Matt
>
> On Sat, Jul 2, 2011 at 12:36 PM, Benjamin Venditti 
> <benjamin.venditti@arcor.de <ma...@arcor.de>> wrote:
>
>     Hi there,
>
>     i just committed a working solution for EMPIREDB-110 the
>     reverse-engineering of foreign-key relationships.
>     i'd be happy if anyone could have a look at it.
>
>
>     Cherio
>        Benjamin
>
>     Am 29.06.2011 15:12, schrieb Matt DeHoust:
>
>         Thank you Benjamin and Rainer. I have subscribed to the dev
>         list. I'll take
>
>         a look at the code when I return from vacation and follow up
>         using the dev
>         list with any questions or ideas. I hope to have a chance to
>         look into it
>         this weekend.
>
>         -Matt
>
>         On Wed, Jun 29, 2011 at 6:30 AM, Rainer
>         Döbele<doebele@esteam.de <ma...@esteam.de>>  wrote:
>
>             Hi everyone,****
>
>             ** **
>
>             I think this is an important improvement of the code
>             generator that we
>             should implement.****
>
>             I have created a Jira Issue for this:****
>
>             ** **
>
>             https://issues.apache.org/jira/browse/EMPIREDB-110****
>
>             ** **
>
>             Matt, if you feel you can and want to do It, then we would
>             certainly
>             appreciate this.****
>
>             You may create a patch file and attach it to the JIRA
>             ticket.****
>
>             Then we can apply the patch and commit the code to svn.****
>
>             ** **
>
>             For further discussion I would recommend to move to the
>             dev-mailing list:*
>             ***
>
>             empire-db-dev@incubator.apache.org
>             <ma...@incubator.apache.org>****
>
>             ** **
>
>             Thanks, ****
>
>             Rainer****
>
>             ** **
>
>             ** **
>
>             *Von:* Benjamin Venditti
>             [mailto:benjamin.venditti@arcor.de
>             <ma...@arcor.de>]
>             *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>             *An:* empire-db-user@incubator.apache.org
>             <ma...@incubator.apache.org>
>             *Cc:* Matt DeHoust
>             *Betreff:* Re: Relationships****
>
>             ** **
>
>             Hi Matt,
>
>             thanks for your interest in empire-db.
>
>             regarding your request ... unfortunately the codegen does
>             not set up the
>             relation of the database model.
>             At the moment the codegen will only set up views and
>             tables. We thought
>             these are the most important for the most people as they
>             are usually
>             sufficient for simple data access.
>
>             However i think there are two occasions where the
>             relations are important:
>                 - database creation
>                 - deletion of records with cascading deletion enabled
>
>             At the moment we have not planned to add "relationship
>             generation"  to the
>             codegen component, but I am glad to hear that you consider
>             to extend it on
>             your own.
>
>             The right place to start with that would be:
>                * CodeGenParser.populateDatabase(..) : 131* : This is
>             the point where
>             the DatabaseMetaData is querried and used to populate
>             empire-db's model
>                 *CodeGenWriter.generateCodeFiles(..) : 125* : Is used
>             to serialize the
>             populated model as java code
>                 *src/main/resources/Database.vm :  70* : This is the
>             velocity template
>             we use to create the java class for the database.
>
>             In its default constructor you'd need to add a line for
>             each relationship
>             similar to this:
>
>                                             *addRelation(
>             EMPLOYEES.DEPARTMENT_ID.referenceOn(
>             DEPARTMENTS.DEPARTMENT_ID ));*
>
>             I hope this is of some help to you. Feel free to ask if
>             you have further
>             questions!
>
>             Cherio
>                 Benjamin
>
>             Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>
>             Hello, ****
>
>             ** **
>
>             I see that the empire-db model supports relationships (for
>             example
>             DBDatabase.getRelations()), but it doesn't seem that the
>             codegen component
>             sets them up. Am I missing something? (I am using MySQL if
>             that matters.)*
>             ***
>
>             ** **
>
>             If not, are there plans to introduce relationship setup in
>             the codegen
>             component?****
>
>             ** **
>
>             If not, where should I look to add them myself?
>             CodeGenParser?****
>
>             ** **
>
>             Thanks,****
>
>             Matt****
>
>             ** **
>
>             P.S. I apologize if I posted this question twice by
>             mitake.****
>
>             ** **
>
>
>


Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi there,

i just committed a working solution for EMPIREDB-110 the 
reverse-engineering of foreign-key relationships.
i'd be happy if anyone could have a look at it.

Cherio
     Benjamin

Am 29.06.2011 15:12, schrieb Matt DeHoust:
> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take
> a look at the code when I return from vacation and follow up using the dev
> list with any questions or ideas. I hope to have a chance to look into it
> this weekend.
>
> -Matt
>
> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>  wrote:
>
>> Hi everyone,****
>>
>> ** **
>>
>> I think this is an important improvement of the code generator that we
>> should implement.****
>>
>> I have created a Jira Issue for this:****
>>
>> ** **
>>
>> https://issues.apache.org/jira/browse/EMPIREDB-110****
>>
>> ** **
>>
>> Matt, if you feel you can and want to do It, then we would certainly
>> appreciate this.****
>>
>> You may create a patch file and attach it to the JIRA ticket.****
>>
>> Then we can apply the patch and commit the code to svn.****
>>
>> ** **
>>
>> For further discussion I would recommend to move to the dev-mailing list:*
>> ***
>>
>> empire-db-dev@incubator.apache.org****
>>
>> ** **
>>
>> Thanks, ****
>>
>> Rainer****
>>
>> ** **
>>
>> ** **
>>
>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>> *An:* empire-db-user@incubator.apache.org
>> *Cc:* Matt DeHoust
>> *Betreff:* Re: Relationships****
>>
>> ** **
>>
>> Hi Matt,
>>
>> thanks for your interest in empire-db.
>>
>> regarding your request ... unfortunately the codegen does not set up the
>> relation of the database model.
>> At the moment the codegen will only set up views and tables. We thought
>> these are the most important for the most people as they are usually
>> sufficient for simple data access.
>>
>> However i think there are two occasions where the relations are important:
>>      - database creation
>>      - deletion of records with cascading deletion enabled
>>
>> At the moment we have not planned to add "relationship generation"  to the
>> codegen component, but I am glad to hear that you consider to extend it on
>> your own.
>>
>> The right place to start with that would be:
>>     * CodeGenParser.populateDatabase(..) : 131* : This is the point where
>> the DatabaseMetaData is querried and used to populate empire-db's model
>>      *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize the
>> populated model as java code
>>      *src/main/resources/Database.vm :  70* : This is the velocity template
>> we use to create the java class for the database.
>>
>> In its default constructor you'd need to add a line for each relationship
>> similar to this:
>>
>>                                  *addRelation(
>> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>
>> I hope this is of some help to you. Feel free to ask if you have further
>> questions!
>>
>> Cherio
>>      Benjamin
>>
>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>
>> Hello, ****
>>
>> ** **
>>
>> I see that the empire-db model supports relationships (for example
>> DBDatabase.getRelations()), but it doesn't seem that the codegen component
>> sets them up. Am I missing something? (I am using MySQL if that matters.)*
>> ***
>>
>> ** **
>>
>> If not, are there plans to introduce relationship setup in the codegen
>> component?****
>>
>> ** **
>>
>> If not, where should I look to add them myself? CodeGenParser?****
>>
>> ** **
>>
>> Thanks,****
>>
>> Matt****
>>
>> ** **
>>
>> P.S. I apologize if I posted this question twice by mitake.****
>>
>> ** **
>>


Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi there,

i just committed a working solution for EMPIREDB-110 the 
reverse-engineering of foreign-key relationships.
i'd be happy if anyone could have a look at it.

Cherio
     Benjamin

Am 29.06.2011 15:12, schrieb Matt DeHoust:
> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take
> a look at the code when I return from vacation and follow up using the dev
> list with any questions or ideas. I hope to have a chance to look into it
> this weekend.
>
> -Matt
>
> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>  wrote:
>
>> Hi everyone,****
>>
>> ** **
>>
>> I think this is an important improvement of the code generator that we
>> should implement.****
>>
>> I have created a Jira Issue for this:****
>>
>> ** **
>>
>> https://issues.apache.org/jira/browse/EMPIREDB-110****
>>
>> ** **
>>
>> Matt, if you feel you can and want to do It, then we would certainly
>> appreciate this.****
>>
>> You may create a patch file and attach it to the JIRA ticket.****
>>
>> Then we can apply the patch and commit the code to svn.****
>>
>> ** **
>>
>> For further discussion I would recommend to move to the dev-mailing list:*
>> ***
>>
>> empire-db-dev@incubator.apache.org****
>>
>> ** **
>>
>> Thanks, ****
>>
>> Rainer****
>>
>> ** **
>>
>> ** **
>>
>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>> *An:* empire-db-user@incubator.apache.org
>> *Cc:* Matt DeHoust
>> *Betreff:* Re: Relationships****
>>
>> ** **
>>
>> Hi Matt,
>>
>> thanks for your interest in empire-db.
>>
>> regarding your request ... unfortunately the codegen does not set up the
>> relation of the database model.
>> At the moment the codegen will only set up views and tables. We thought
>> these are the most important for the most people as they are usually
>> sufficient for simple data access.
>>
>> However i think there are two occasions where the relations are important:
>>      - database creation
>>      - deletion of records with cascading deletion enabled
>>
>> At the moment we have not planned to add "relationship generation"  to the
>> codegen component, but I am glad to hear that you consider to extend it on
>> your own.
>>
>> The right place to start with that would be:
>>     * CodeGenParser.populateDatabase(..) : 131* : This is the point where
>> the DatabaseMetaData is querried and used to populate empire-db's model
>>      *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize the
>> populated model as java code
>>      *src/main/resources/Database.vm :  70* : This is the velocity template
>> we use to create the java class for the database.
>>
>> In its default constructor you'd need to add a line for each relationship
>> similar to this:
>>
>>                                  *addRelation(
>> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>
>> I hope this is of some help to you. Feel free to ask if you have further
>> questions!
>>
>> Cherio
>>      Benjamin
>>
>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>
>> Hello, ****
>>
>> ** **
>>
>> I see that the empire-db model supports relationships (for example
>> DBDatabase.getRelations()), but it doesn't seem that the codegen component
>> sets them up. Am I missing something? (I am using MySQL if that matters.)*
>> ***
>>
>> ** **
>>
>> If not, are there plans to introduce relationship setup in the codegen
>> component?****
>>
>> ** **
>>
>> If not, where should I look to add them myself? CodeGenParser?****
>>
>> ** **
>>
>> Thanks,****
>>
>> Matt****
>>
>> ** **
>>
>> P.S. I apologize if I posted this question twice by mitake.****
>>
>> ** **
>>


Re: Relationships

Posted by Benjamin Venditti <be...@arcor.de>.
Hi Matt,

i just took a deeper look into the generation of foreign-key 
relationships, and it doesn't seem to be too difficult.
Therefore i already started and finished the first of my suggested steps 
"querried the DatabaseMetaDate for relations and populate the empire db 
model".
I hope you don't mind that started with it. I think a first working 
version should be finished by this evening (within the next 3-4 hours).

I'd be glad if you could have a look at my code, maybe i missed something.

Cherio
     Benjamin


Am 29.06.2011 15:12, schrieb Matt DeHoust:
> Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take
> a look at the code when I return from vacation and follow up using the dev
> list with any questions or ideas. I hope to have a chance to look into it
> this weekend.
>
> -Matt
>
> On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele<do...@esteam.de>  wrote:
>
>> Hi everyone,****
>>
>> ** **
>>
>> I think this is an important improvement of the code generator that we
>> should implement.****
>>
>> I have created a Jira Issue for this:****
>>
>> ** **
>>
>> https://issues.apache.org/jira/browse/EMPIREDB-110****
>>
>> ** **
>>
>> Matt, if you feel you can and want to do It, then we would certainly
>> appreciate this.****
>>
>> You may create a patch file and attach it to the JIRA ticket.****
>>
>> Then we can apply the patch and commit the code to svn.****
>>
>> ** **
>>
>> For further discussion I would recommend to move to the dev-mailing list:*
>> ***
>>
>> empire-db-dev@incubator.apache.org****
>>
>> ** **
>>
>> Thanks, ****
>>
>> Rainer****
>>
>> ** **
>>
>> ** **
>>
>> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
>> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
>> *An:* empire-db-user@incubator.apache.org
>> *Cc:* Matt DeHoust
>> *Betreff:* Re: Relationships****
>>
>> ** **
>>
>> Hi Matt,
>>
>> thanks for your interest in empire-db.
>>
>> regarding your request ... unfortunately the codegen does not set up the
>> relation of the database model.
>> At the moment the codegen will only set up views and tables. We thought
>> these are the most important for the most people as they are usually
>> sufficient for simple data access.
>>
>> However i think there are two occasions where the relations are important:
>>      - database creation
>>      - deletion of records with cascading deletion enabled
>>
>> At the moment we have not planned to add "relationship generation"  to the
>> codegen component, but I am glad to hear that you consider to extend it on
>> your own.
>>
>> The right place to start with that would be:
>>     * CodeGenParser.populateDatabase(..) : 131* : This is the point where
>> the DatabaseMetaData is querried and used to populate empire-db's model
>>      *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize the
>> populated model as java code
>>      *src/main/resources/Database.vm :  70* : This is the velocity template
>> we use to create the java class for the database.
>>
>> In its default constructor you'd need to add a line for each relationship
>> similar to this:
>>
>>                                  *addRelation(
>> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>>
>> I hope this is of some help to you. Feel free to ask if you have further
>> questions!
>>
>> Cherio
>>      Benjamin
>>
>> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>>
>> Hello, ****
>>
>> ** **
>>
>> I see that the empire-db model supports relationships (for example
>> DBDatabase.getRelations()), but it doesn't seem that the codegen component
>> sets them up. Am I missing something? (I am using MySQL if that matters.)*
>> ***
>>
>> ** **
>>
>> If not, are there plans to introduce relationship setup in the codegen
>> component?****
>>
>> ** **
>>
>> If not, where should I look to add them myself? CodeGenParser?****
>>
>> ** **
>>
>> Thanks,****
>>
>> Matt****
>>
>> ** **
>>
>> P.S. I apologize if I posted this question twice by mitake.****
>>
>> ** **
>>


Re: Relationships

Posted by Matt DeHoust <md...@gmail.com>.
Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take
a look at the code when I return from vacation and follow up using the dev
list with any questions or ideas. I hope to have a chance to look into it
this weekend.

-Matt

On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele <do...@esteam.de> wrote:

> Hi everyone,****
>
> ** **
>
> I think this is an important improvement of the code generator that we
> should implement.****
>
> I have created a Jira Issue for this:****
>
> ** **
>
> https://issues.apache.org/jira/browse/EMPIREDB-110****
>
> ** **
>
> Matt, if you feel you can and want to do It, then we would certainly
> appreciate this.****
>
> You may create a patch file and attach it to the JIRA ticket.****
>
> Then we can apply the patch and commit the code to svn.****
>
> ** **
>
> For further discussion I would recommend to move to the dev-mailing list:*
> ***
>
> empire-db-dev@incubator.apache.org****
>
> ** **
>
> Thanks, ****
>
> Rainer****
>
> ** **
>
> ** **
>
> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
> *An:* empire-db-user@incubator.apache.org
> *Cc:* Matt DeHoust
> *Betreff:* Re: Relationships****
>
> ** **
>
> Hi Matt,
>
> thanks for your interest in empire-db.
>
> regarding your request ... unfortunately the codegen does not set up the
> relation of the database model.
> At the moment the codegen will only set up views and tables. We thought
> these are the most important for the most people as they are usually
> sufficient for simple data access.
>
> However i think there are two occasions where the relations are important:
>     - database creation
>     - deletion of records with cascading deletion enabled
>
> At the moment we have not planned to add "relationship generation"  to the
> codegen component, but I am glad to hear that you consider to extend it on
> your own.
>
> The right place to start with that would be:
>    * CodeGenParser.populateDatabase(..) : 131* : This is the point where
> the DatabaseMetaData is querried and used to populate empire-db's model
>     *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize the
> populated model as java code
>     *src/main/resources/Database.vm :  70* : This is the velocity template
> we use to create the java class for the database.
>
> In its default constructor you'd need to add a line for each relationship
> similar to this:
>
>                                 *addRelation(
> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>
> I hope this is of some help to you. Feel free to ask if you have further
> questions!
>
> Cherio
>     Benjamin
>
> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>
> Hello, ****
>
> ** **
>
> I see that the empire-db model supports relationships (for example
> DBDatabase.getRelations()), but it doesn't seem that the codegen component
> sets them up. Am I missing something? (I am using MySQL if that matters.)*
> ***
>
> ** **
>
> If not, are there plans to introduce relationship setup in the codegen
> component?****
>
> ** **
>
> If not, where should I look to add them myself? CodeGenParser?****
>
> ** **
>
> Thanks,****
>
> Matt****
>
> ** **
>
> P.S. I apologize if I posted this question twice by mitake.****
>
> ** **
>

Re: Relationships

Posted by Matt DeHoust <md...@gmail.com>.
Thank you Benjamin and Rainer. I have subscribed to the dev list. I'll take
a look at the code when I return from vacation and follow up using the dev
list with any questions or ideas. I hope to have a chance to look into it
this weekend.

-Matt

On Wed, Jun 29, 2011 at 6:30 AM, Rainer Döbele <do...@esteam.de> wrote:

> Hi everyone,****
>
> ** **
>
> I think this is an important improvement of the code generator that we
> should implement.****
>
> I have created a Jira Issue for this:****
>
> ** **
>
> https://issues.apache.org/jira/browse/EMPIREDB-110****
>
> ** **
>
> Matt, if you feel you can and want to do It, then we would certainly
> appreciate this.****
>
> You may create a patch file and attach it to the JIRA ticket.****
>
> Then we can apply the patch and commit the code to svn.****
>
> ** **
>
> For further discussion I would recommend to move to the dev-mailing list:*
> ***
>
> empire-db-dev@incubator.apache.org****
>
> ** **
>
> Thanks, ****
>
> Rainer****
>
> ** **
>
> ** **
>
> *Von:* Benjamin Venditti [mailto:benjamin.venditti@arcor.de]
> *Gesendet:* Mittwoch, 29. Juni 2011 01:47
> *An:* empire-db-user@incubator.apache.org
> *Cc:* Matt DeHoust
> *Betreff:* Re: Relationships****
>
> ** **
>
> Hi Matt,
>
> thanks for your interest in empire-db.
>
> regarding your request ... unfortunately the codegen does not set up the
> relation of the database model.
> At the moment the codegen will only set up views and tables. We thought
> these are the most important for the most people as they are usually
> sufficient for simple data access.
>
> However i think there are two occasions where the relations are important:
>     - database creation
>     - deletion of records with cascading deletion enabled
>
> At the moment we have not planned to add "relationship generation"  to the
> codegen component, but I am glad to hear that you consider to extend it on
> your own.
>
> The right place to start with that would be:
>    * CodeGenParser.populateDatabase(..) : 131* : This is the point where
> the DatabaseMetaData is querried and used to populate empire-db's model
>     *CodeGenWriter.generateCodeFiles(..) : 125* : Is used to serialize the
> populated model as java code
>     *src/main/resources/Database.vm :  70* : This is the velocity template
> we use to create the java class for the database.
>
> In its default constructor you'd need to add a line for each relationship
> similar to this:
>
>                                 *addRelation(
> EMPLOYEES.DEPARTMENT_ID.referenceOn( DEPARTMENTS.DEPARTMENT_ID ));*
>
> I hope this is of some help to you. Feel free to ask if you have further
> questions!
>
> Cherio
>     Benjamin
>
> Am 28.06.2011 19:37, schrieb Matt DeHoust: ****
>
> Hello, ****
>
> ** **
>
> I see that the empire-db model supports relationships (for example
> DBDatabase.getRelations()), but it doesn't seem that the codegen component
> sets them up. Am I missing something? (I am using MySQL if that matters.)*
> ***
>
> ** **
>
> If not, are there plans to introduce relationship setup in the codegen
> component?****
>
> ** **
>
> If not, where should I look to add them myself? CodeGenParser?****
>
> ** **
>
> Thanks,****
>
> Matt****
>
> ** **
>
> P.S. I apologize if I posted this question twice by mitake.****
>
> ** **
>