You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cayenne.apache.org by Michał Morzywołek <ni...@gmail.com> on 2008/06/01 21:02:16 UTC

Inheritance: invalid child - ObjPath ...:(

Hello,

First: short polish lesson:
Pojazd = Vehicle
Motocykl=Motobike :)

I got this simple Inheritance structure:
Motocykl gets atributes and relations of Pojazd. I created such structure in
the Cayenne Modeler.
Got one big table "Pojazd" with atributes of both classes (Single Table
Inheritance").
Got class "Pojazd" which is casuall class with some atributes and relations.
Got class "Motocykl" with "Inheritance" set to Pojazd and qualifier set to
"motocykl".
Motocykl class got some additional attributes and is also mapped to table
"Pojazd".

In the generated code i can see that the class stucture is good. Also the
database seems to be fine.
Problem is that when I try to register/create new object of the Motorbike
class...

Motocykl mm=DAO.getDataContext().newObject(Motocykl.class);
DAO.getDataContext().commitChanges();

(dao class:)
public class DAO {

    private static DataContext dataContext=DataContext.createDataContext();

    public static DataContext getDataContext()
    {
        return dataContext;
    }

}

i get this exception:
2008-06-01 20:55:52 org.apache.cayenne.access.QueryLogger
logCommitTransaction
INFO: +++ transaction committed.
Exception in thread "main" org.apache.cayenne.exp.ExpressionException:
[v.3.0M3 Jan 27 2008 20:12:33] Or: invalid child - ObjPath
        at
org.apache.cayenne.exp.parser.AggregateConditionNode.jjtAddChild(AggregateConditionNode.java:93)
        at
org.apache.cayenne.exp.parser.SimpleNode.setOperand(SimpleNode.java:233)
        at org.apache.cayenne.exp.Expression.joinExp(Expression.java:302)
        at org.apache.cayenne.exp.Expression.orExp(Expression.java:319)
        at
org.apache.cayenne.map.EntityInheritanceTree.qualifierForEntityAndSubclasses(EntityInheritanceTree.java:68)
        at
org.apache.cayenne.reflect.PersistentDescriptorFactory.indexQualifiers(PersistentDescriptorFactory.java:225)
        at
org.apache.cayenne.reflect.PersistentDescriptorFactory.getDescriptor(PersistentDescriptorFactory.java:128)
        at
org.apache.cayenne.reflect.generic.DataObjectDescriptorFactory.getDescriptor(DataObjectDescriptorFactory.java:57)
        at
org.apache.cayenne.reflect.PersistentDescriptorFactory.getDescriptor(PersistentDescriptorFactory.java:58)
        at
org.apache.cayenne.reflect.ClassDescriptorMap.createDescriptor(ClassDescriptorMap.java:129)
        at
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.checkDescriptorInitialized(LazyClassDescriptorDecorator.java:51)
        at
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.getEntity(LazyClassDescriptorDecorator.java:75)
        at
org.apache.cayenne.reflect.PersistentDescriptor.addSubclassDescriptor(PersistentDescriptor.java:135)
        at
org.apache.cayenne.reflect.PersistentDescriptorFactory.indexSubclassDescriptors(PersistentDescriptorFactory.java:209)
        at
org.apache.cayenne.reflect.PersistentDescriptorFactory.getDescriptor(PersistentDescriptorFactory.java:127)
        at
org.apache.cayenne.reflect.generic.DataObjectDescriptorFactory.getDescriptor(DataObjectDescriptorFactory.java:57)
        at
org.apache.cayenne.reflect.PersistentDescriptorFactory.getDescriptor(PersistentDescriptorFactory.java:58)
        at
org.apache.cayenne.reflect.ClassDescriptorMap.createDescriptor(ClassDescriptorMap.java:129)
        at
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.checkDescriptorInitialized(LazyClassDescriptorDecorator.java:51)
        at
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.injectValueHolders(LazyClassDescriptorDecorator.java:140)
        at
org.apache.cayenne.reflect.PersistentDescriptor.injectValueHolders(PersistentDescriptor.java:298)
        at
org.apache.cayenne.reflect.LazyClassDescriptorDecorator.injectValueHolders(LazyClassDescriptorDecorator.java:141)
        at
org.apache.cayenne.access.DataContext.newObject(DataContext.java:762)
        at
org.apache.cayenne.access.DataContext.newObject(DataContext.java:736)
        at tools.Testy.test3Pomiar1(Testy.java:198)
        at tools.Testy.test3_zapis(Testy.java:185)
        at mainFiles.Main.main(Main.java:29)
Java Result: 1


I don't know whats wrong, tried to regenerate database, classes and so on.
Other question is: How to set Pojazd (vehicle) as abstract class.

Hope you can find out what the hell is wrong :)

Regards,
Mike