ObjectDB ObjectDB

JDO PersistenceCapable Interface for Enhanced Classes

#1

Hallo,

 

in old JDO 1.0 project we use the PersistenceCapable interface like this

    Model model = new Model();
    Model datas List models = new ArrayList();
    models.add((PersistenceCapable) model);

the interface was enhanced to the class.

in the new version we get this
java.lang.ClassCastException: Model cannot be cast to javax.jdo.spi.PersistenceCapable
give it an workaround or so?

edit
delete
#2

Since JDO 2.0 implementing the javax.jdo.spi.PersistenceCapable is optional, and the ObjectDB 2.x Enhancer does not implement that interface.

You should remove the casting and change your code to:

    models.add(model);

 

ObjectDB Support
ObjectDB - Fast Object Database for Java (JPA/JDO)
edit
delete

Reply

To post on this website please sign in.