Re: Help to query!!

From: Reinaldo Coelho Sartorelli (reinaldo_sartorell..ahoo.com.br)
Date: Tue Aug 03 2004 - 15:43:29 EDT

  • Next message: Mike Kienenberger: "Re: Help to query!!"

    On Tuesday 03 August 2004 16:29, Mike Kienenberger wrote:
    > Reinaldo Coelho Sartorelli <reinaldo_sartorell..ahoo.com.br> wrote:
    > > Hi people, i have a code down, but this generate a error :
    > >
    > > Erro: [v.1.1M7_1 June 15 2004] Error creating object for entity
    > > 'Generos'.
    > >
    > >
    > >
    > > public List ListGenero(String Name){
    > > try{
    > > //Class Generos(have a description attribute)
    > > SelectQuery query = new SelectQuery(this.getClass());
    > > List list = conexao.performQuery(query);
    > > System.out.println("OK");
    > > return list;
    > > }
    > > catch(Exception e){
    > > System.out.println("Error: " + e.getMessage());
    > > return null;
    > > }
    > > }
    >
    > I don't see anything immediately wrong.
    >
    > What is this.getClass() -- What is the class this method is in? Is "this"
    > a subclass of CayenneDataObject?

    this.getClass() = Generos.class = Table Generos.

    >
    > Output e.printStackTrace() and post that instead of e.getMessage();

    Follow the printStackTrace() :

    org.objectstyle.cayenne.CayenneRuntimeException: [v.1.1M7_1 June 15 2004]
    Error creating object for entity 'Generos'.
            at
    org.objectstyle.cayenne.access.DataContext.registeredObject(DataContext.java:436)
            at
    org.objectstyle.cayenne.access.DataContext.objectsFromDataRows(DataContext.java:658)
            at
    org.objectstyle.cayenne.access.util.SelectObserver$PrefetchTreeNode.resolveObjectTree(SelectObserver.java:377)
            at
    org.objectstyle.cayenne.access.util.SelectObserver.getResultsAsObjects(SelectObserver.java:193)
            at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1501)
            at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1404)
            at br.com.leiarock.mapeamento.Generos.buscarGenero(Generos.java:96)
            at testes.main(testes.java:24)
    Caused by: java.lang.InstantiationException:
    br.com.leiarock.mapeamento.Generos
            at java.lang.Class.newInstance0(Class.java:293)
            at java.lang.Class.newInstance(Class.java:261)
            at
    org.objectstyle.cayenne.access.DataContext.newDataObject(DataContext.java:201)
            at
    org.objectstyle.cayenne.access.DataContext.registeredObject(DataContext.java:427)
            ... 7 more

    Sorry my english people.
    Tks.
    Reinaldo.



    This archive was generated by hypermail 2.0.0 : Tue Aug 03 2004 - 15:43:21 EDT