You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Davide Marche <ja...@email.it> on 2006/01/25 09:50:56 UTC

Abator generation features

Hi everybody,

I am new in the list and i have just started using Abator for my
project. I have a question (i couldn't find the answer anywhere in the
abator's documentation). In my database schema i have something like

Product(...., id_category,...)
Category(id,....)

and of course Product.id_category references Category.id . With iBATIS
documentation i am able to map this to my java classes so:

public class Product{
         ........
         Category category;
         .....
}
public class Category{
          .....
}

With Abator i couldn't find a way to generate such a model, it still
goes on generating

public class Product{
         ........
         Integer id_category;
         .....
}


Is there any way to solve the problem with Abator or should i start
generating the files myself?

Thanks in advance



Re: Abator generation features

Posted by Davide Marche <ja...@email.it>.
Thank you Jeff, you were a precious help for me :-)
And generally Abator is still a precious help for me in this project.

DM.


Jeff Butler ha scritto:
> As you've discovered, Abator does not trace relationships through your
> database or generate this kind of a rich object model.  I've been
> thinking about ways to add that feature, but it is a very complex
> problem to solve in a general way.  So yes, you'll need to generate
> custom queries and objects for this kind of model.
>  
> Abator can still be of use to you because it will generate correct
> insert, update, and delete statements.  You should also be able to
> reference some of the Abator generated select stuff too - for example,
> the result maps are often reusable in more complex queries.
>  
> In my experience, Abator generates a good foundation for building on. 
> You can (and usually should) generate custom queries to fill out the
> remainder of your model.  You can add your custom queries to the same
> sql map files and Abator won't overwrite them when/if you regenerate.
>  
> You can also see the "philosophy" page in the Eclipse documentation
> for more thoughts about this subject.  Here's an SVN link if you're
> not using Eclipse:
>  
> http://svn.apache.org/repos/asf/ibatis/trunk/java/mapper/mapper2/tools/abator/eclipse/org.apache.ibatis.abator.doc/html/gettingstarted/philosophy.html
> <http://svn.apache.org/repos/asf/ibatis/trunk/java/mapper/mapper2/tools/abator/eclipse/org.apache.ibatis.abator.doc/html/gettingstarted/philosophy.html>
>  
> HTH -
> Jeff Butler
>
>



Re: Abator generation features

Posted by Jeff Butler <je...@gmail.com>.
As you've discovered, Abator does not trace relationships through your
database or generate this kind of a rich object model.  I've been thinking
about ways to add that feature, but it is a very complex problem to solve in
a general way.  So yes, you'll need to generate custom queries and objects
for this kind of model.

Abator can still be of use to you because it will generate correct insert,
update, and delete statements.  You should also be able to reference some of
the Abator generated select stuff too - for example, the result maps are
often reusable in more complex queries.

In my experience, Abator generates a good foundation for building on.  You
can (and usually should) generate custom queries to fill out the remainder
of your model.  You can add your custom queries to the same sql map files
and Abator won't overwrite them when/if you regenerate.

You can also see the "philosophy" page in the Eclipse documentation for more
thoughts about this subject.  Here's an SVN link if you're not using
Eclipse:

http://svn.apache.org/repos/asf/ibatis/trunk/java/mapper/mapper2/tools/abator/eclipse/org.apache.ibatis.abator.doc/html/gettingstarted/philosophy.html

HTH -
Jeff Butler



On 1/25/06, Davide Marche <ja...@email.it> wrote:
>
> Hi everybody,
>
> I am new in the list and i have just started using Abator for my
> project. I have a question (i couldn't find the answer anywhere in the
> abator's documentation). In my database schema i have something like
>
> Product(...., id_category,...)
> Category(id,....)
>
> and of course Product.id_category references Category.id . With iBATIS
> documentation i am able to map this to my java classes so:
>
> public class Product{
>         ........
>         Category category;
>         .....
> }
> public class Category{
>          .....
> }
>
> With Abator i couldn't find a way to generate such a model, it still
> goes on generating
>
> public class Product{
>         ........
>         Integer id_category;
>         .....
> }
>
>
> Is there any way to solve the problem with Abator or should i start
> generating the files myself?
>
> Thanks in advance
>
>
>