Hi,
I realised that I have a mistake (from application logic point of view) in one of my JDO metadata files:
<jdo> <package name="my.example.package"> <class name="InnerSettings"> <field name="attributes" embedded="true"> <map embedded-key="true" embedded-value="true" /> </field> </class> <class name="BasicSettings"> <field name="userRoles" embedded="true"/> <field name="innerSettings" embedded="true"> <map embedded-key="true" embedded-value="true" /> </field> </class> <class name="StoreSettings" persistence-capable-superclass="BasicSettings"/> <class name="AnalyzeSettings" persistence-capable-superclass="BasicSettings"/> </package> </jdo>
All of these 3 classes should be embedded-only as they are stored only in a HashMap of another Entity.
So as first try I changed only the metadata to this:
<jdo> <package name="my.example.package"> <class name="InnerSettings" embedded-only="true"> <field name="attributes" embedded="true"> <map embedded-key="true" embedded-value="true" /> </field> </class> <class name="BasicSettings" embedded-only="true"> <field name="userRoles" embedded="true"/> <field name="innerSettings" embedded="true"> <map embedded-key="true" embedded-value="true" /> </field> </class> <class name="StoreSettings" persistence-capable-superclass="BasicSettings"/> <class name="AnalyzeSettings" persistence-capable-superclass="BasicSettings"/> </package> </jdo>
The application seemed to work normally with existing values and also the new values got stored in DB.
However since this change I can not open the DB file in Explorer.
I get this exception:
java.lang.ClassCastException: com.objectdb.jpa.type.EmbeddableTypeImpl cannot be cast to com.objectdb.jpa.type.IdentifiableTypeImpl at com.objectdb.jpa.type.IdentifiableTypeImpl.<init>(IdentifiableTypeImpl.java:63) at com.objectdb.jpa.type.EntityTypeImpl.<init>(EntityTypeImpl.java:42) at com.objectdb.jpa.MetamodelImpl.a(MetamodelImpl.java:323) at com.objectdb.jpa.MetamodelImpl.b(MetamodelImpl.java:287) at com.objectdb.jpa.MetamodelImpl.c(MetamodelImpl.java:232) at com.objectdb.jpa.MetamodelImpl.getManagedTypes(MetamodelImpl.java:97) at com.objectdb.o.EHL.k(EHL.java:58) at com.objectdb.o.MetamodelItem.<init>(MetamodelItem.java:39) at com.objectdb.o.SchemaPanel.g(SchemaPanel.java:126) at com.objectdb.o.MainFrame.f(MainFrame.java:235) at com.objectdb.o.MainFrame.f(MainFrame.java:233) at com.objectdb.o.MainFrame.f(MainFrame.java:233) at com.objectdb.o.MainFrame.f(MainFrame.java:233) at com.objectdb.o.MainFrame.e(MainFrame.java:218) at com.objectdb.o.EXA.k(EXA.java:196) at com.objectdb.o.EXA.j(EXA.java:188) at com.objectdb.o.CNC.s(CNC.java:120) at com.objectdb.o.EXA.<init>(EXA.java:87) at com.objectdb.Explorer$1.run(Explorer.java:57) at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311) at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:756) at java.awt.EventQueue.access$500(EventQueue.java:97) at java.awt.EventQueue$3.run(EventQueue.java:709) at java.awt.EventQueue$3.run(EventQueue.java:703) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80) at java.awt.EventQueue.dispatchEvent(EventQueue.java:726) at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201) at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116) at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101) at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93) at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
I thought that simply changing JDO metadata is not sufficient. Should it be sufficient btw ?
So I left these classes NOT embedded in JDO, introduced copies of these classes in another package which were defined as embedded-only, made a migration utility which read the original objects, converted them to the new classes and stored them instead of the old ones. The old ones I deleted.
And again the app was working fine, but on opening the DB file in Explorer I got again the above exception.
I would appreciate some guidance in this matter.
Is the change of not-embedded to embedded supported by ObjectDB for existing objects? If it is, do I have to write the "embedded-only" clausule also to the child classes or is it sufficient to write it on their predecessor ?
Is this only a bug in Explorer? Or do I have to change something in my code ?
Thx.