Yep….thats the only way I could get around it …. Jeff : Any news on a formal release of abator with the superclass/superinterface for DAO’s / VO’s yet ?

 

 

 

            public Object writeSingle(XMLObject o)

            {

                        Object retval=null;

                        try

                        {

                                    ValueObject vo=o.getValueObject();

                                    if(vo!=null)

                                    {

                                                Integer update= new Integer(0);

                                                BaseDAO dao = getDaoForValueObject(vo);

                                                if(dao==null)

                                                {

                                                            log("ERROR DAO IS NULL");

                                                }

                                                if(o.isUpdateable())

                                                {

                                                            ValueObject example=o.getExample();

                                                            Class[] updClazzes = new Class[1];

                                                            updClazzes[0]= example.getClass();

                                                            Method updater=dao.getClass().getMethod("updateByExample",updClazzes);

                                                            Object[] updObjs=new Object[1];

                                                            updObjs[0]=example;

                                                            update = (Integer)updater.invoke(dao,updObjs);

                                                }

                                                if(update.intValue()==0)

                                                {

                                                            Class[] insClazzes = new Class[1];

                                                            insClazzes[0]= vo.getClass();

                                                            Object[] insObjs=new Object[1];

                                                            insObjs[0]=vo;

                                                            Method insert=dao.getClass().getMethod("insert",insClazzes);

                                                            retval = insert.invoke(dao,insObjs);

                                                }

                                    }

                        }

                        catch(Exception e){

                                    e.printStackTrace();}

                        return retval;

            }

-----Original Message-----
From: Jeff Butler [mailto:[EMAIL PROTECTED]]
Sent
:
28 April 2006 14:06
To: [email protected]
Subject: Re: Abator generated Classes: How to get all getters(primary key also) from the generated Class

 

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 <[EMAIL PROTECTED]> 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?

 


 

Reply via email to