Re: Help to query!!

From: Mike Kienenberger (mkienen..laska.net)
Date: Tue Aug 03 2004 - 15:59:46 EDT

  • Next message: Reinaldo Coelho Sartorelli: "Re: Help to query!!"

    Reinaldo Coelho Sartorelli <reinaldo_sartorell..ahoo.com.br> wrote:
    > > 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)

    > 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

    >From
    http://java.sun.com/j2se/1.4.2/docs/api/java/lang/InstantiationException.html:

    Thrown when an application tries to create an instance of a class using the
    newInstance method in class Class, but the specified class object cannot be
    instantiated because it is an interface or is an abstract class.

    This makes me think that "br.com.leiarock.mapeamento.Generos" is not a
    subclass of CayenneDataObject, or that it's been manually set to be
    abstract. Hope this helps. Make sure that you are creating Generos using
    the Cayenne Modeler tool.

    Your code hierarchy should look like one of the following patterns:

            public class Generos extends CayenneDataObject

    or

            public class [superclass] extends CayenneDataObject
            public class Generos extends [superclass]

    or

            public class _Generos extends CayenneDataObject
            public class Generos extends _Generos

    or

            public class [superclass] extends CayenneDataObject
            public class _Generos extends [superclass]
            public class Generos extends _Generos

    -Mike



    This archive was generated by hypermail 2.0.0 : Tue Aug 03 2004 - 15:59:14 EDT