Home » Support » Forum » JDO PersistenceCapable Interface for Enhanced Classes

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?

#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)

Post Reply

To post a reply and/or subscribe to update notifications - please login