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 Vicente Tarín Font <v....@dimension-informatica.es> on 2006/04/28 12:36:51 UTC

Abator generated Classes: How to get all getters(primary key also) from the generated Class

I've used Abator to generate the java Classes which represent the DB table.
 
There is a Class representing the table, and another Class representing the primary key of the table.
I want to get all the column values using the getters, but if I use getClass().getDeclaredMethods() or getClass().getDeclaredFields(), i don't get the primary key.
 
I solve this with :
 
getClass().getSuperclass().getDeclaredFields() 
or 
getClass().getSuperclass().getDeclaredMethods()
 
 
My question is: Is there another way (config?) to achieve this?
 

Re: Abator generated Classes: How to get all getters(primary key also) from the generated Class

Posted by Jeff Butler <je...@gmail.com>.
It is a central concept of Abator that there are different classes for the
primary key and the remaining fields.  Also...if your table contains BLOB
fields, there will be another class that just holds the BLOBs.

You could do getClass().getMethods() - this will return all the public
methods (including the methods in the superclass).

Jeff Butler



On 4/28/06, Vicente Tarín Font <v....@dimension-informatica.es> wrote:
>
>  I've used Abator to generate the java Classes which represent the DB
> table.
>
> There is a Class representing the table, and another Class representing
> the primary key of the table.
> I want to get all the column values using the getters, but if I use
> getClass().getDeclaredMethods() or getClass().getDeclaredFields(), i don't
> get the primary key.
>
> I solve this with :
>
> getClass().getSuperclass().getDeclaredFields()
> or
> getClass().getSuperclass().getDeclaredMethods()
>
>
> My question is: Is there another way (config?) to achieve this?
>
>
>