ObjectDB ObjectDB

Extending model by "common entity"

#1

Hi,

I have a question about extending working model with one, common entity, that all other entities will inherit from. For example I have 2 different entities in database with some data:


@Entity
public class Entity1 implements Serializable {
    private String val1;
    private String val2;

    // (getters and setters here)
}   
and the second one:

@Entity
public class Entity2 implements Serializable {
    private String val4;

    // (getters and setters here)
}
Now I want to create BaseEntity which all common attributes:

@Entity
public class BaseEntity implements Serializable {
    private String createdBy;
    private Date createdAt;
    private String modifiedBy;
    private Date modifiedAt;   

    // (getters and setters here)
}
Then Entity1 and Entity2 will be modified to inherit from BaseEntity, so:

@Entity
public class Entity1 extends BaseEntity implements Serializable{}
And the same for Entity2. The problem is, that when I have some data in database, after compiling and running new version of application, I got some errors:
java.lang.NoClassDefFoundError: pl/hplxtool/model/BaseEntity
  at java.lang.ClassLoader.defineClass1(Native Method) ~[na:1.6.0_22]
  at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632) ~[na:1.6.0_22]
  at java.lang.ClassLoader.defineClass(ClassLoader.java:616) ~[na:1.6.0_22]
  at java.lang.ClassLoader.defineClass(ClassLoader.java:466) ~[na:1.6.0_22]
  at com.objectdb.o.ACL.e(ACL.java:175) ~[objectdb.jar:na]
  at com.objectdb.o.STL.h(STL.java:97) ~[objectdb.jar:na]
  at com.objectdb.o.TYM.findClass(TYM.java:954) ~[objectdb.jar:na]
  at com.objectdb.o.ACL.loadClass(ACL.java:137) ~[objectdb.jar:na]
  at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ~[na:1.6.0_22]
  at com.objectdb.o.TYM.at(TYM.java:931) ~[objectdb.jar:na]
  at com.objectdb.o.UTY.initSysType(UTY.java:317) ~[objectdb.jar:na]
  at com.objectdb.o.TYS.l(TYS.java:163) ~[objectdb.jar:na]
  at com.objectdb.o.TYM.aa(TYM.java:469) ~[objectdb.jar:na]
  at com.objectdb.o.TYM.<init>(TYM.java:229) ~[objectdb.jar:na]
  at com.objectdb.o.MST.aE(MST.java:175) ~[objectdb.jar:na]
  at com.objectdb.o.SHN.U(SHN.java:258) ~[objectdb.jar:na]
  at com.objectdb.o.SHN.I(SHN.java:108) ~[objectdb.jar:na]
  at com.objectdb.o.HND.run(HND.java:119) ~[objectdb.jar:na]
  at java.lang.Thread.run(Thread.java:662) [na:1.6.0_22]

Caused by: java.lang.ClassNotFoundException: pl.hplxtool.model.BaseEntity
  at com.objectdb.o.TYM.findClass(TYM.java:951) ~[objectdb.jar:na]
  at com.objectdb.o.ACL.loadClass(ACL.java:137) ~[objectdb.jar:na] at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ~[na:1.6.0_22]
How can I propagate that kind of changes with ODB model? The same exceptions are thrown when I run explorer or doctor.
edit
delete
#2

This schema change should be handled by ObjectDB - so the exception is unexpected.

Maybe you have to restart the server (I see that the stack trace is generated by the server).

If it doesn't help - please post (or submit in a support ticket) a test case that demonstrates this exception.

ObjectDB Support
edit
delete
#3

Restart didn't help at all. I will prepare test case and submit a support ticket.

edit
delete
#4

Thank you for the test application - it demonstrates a bug in ObjectDB schema evolution.

Please check build 2.0.5_01 that should fix it.

If possible - apply the schema change again to a database that was used only with the old schema.

If you must repair a database file that was already used with the new schema - open it once in embedded mode from your application (not using the Explorer) - after rebuilding all the classes.

ObjectDB Support
edit
delete

Reply

To post on this website please sign in.