Hi everyone!
Now i playing with OrientDB 2.1.2 ObjectAPI trying to adapt it for already
working old project. In this project i have POJO classes containing fields
with specific collection interfaces (for example map) like below:
public class MyPOJOs {
private CustomMap customMap;
...
}
public interface CustomMap extends Map<String,Object>, CustomMapAdditions {
void customMapMethod();
}
public interface CustomMapAdditions {
String additionalMethod();
}
And ofcource i have implementation like:
public class CustomMapImpl implements CustomMap {
...
}
When i try to save pojo to database, customMap field recognize as simple
Map (it is even not exists in class scheme), but then, when i try to access
getter getCustomMap i have exception:
java.lang.IllegalArgumentException: Can not set my_package.CustomMap
field my_package.MyPOJOs.customMap to
com.orientechnologies.orient.object.db.OObjectLazyMap
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:167)
at
sun.reflect.UnsafeFieldAccessorImpl.throwSetIllegalArgumentException(UnsafeFieldAccessorImpl.java:171)
at
sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:81)
at java.lang.reflect.Field.set(Field.java:764)
at
com.orientechnologies.orient.object.enhancement.OObjectEntitySerializer.setFieldValue(OObjectEntitySerializer.java:914)
at
com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.lazyLoadField(OObjectProxyMethodHandler.java:635)
at
com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.getValue(OObjectProxyMethodHandler.java:314)
at
com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.getValue(OObjectProxyMethodHandler.java:300)
at
com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.manageGetMethod(OObjectProxyMethodHandler.java:289)
at
com.orientechnologies.orient.object.enhancement.OObjectProxyMethodHandler.invoke(OObjectProxyMethodHandler.java:115)
at my_package.MyPOJOs_$$_jvst9fe_0.getCustomMap(MyPOJOs_$$_jvst9fe_0.java)
at ...
I understand that OrientDB uses own implementations for collections, but is
the way exists to adapt/replace it while pojos deserialize?
Or someone have any other suggestions, tricks?
--
---
You received this message because you are subscribed to the Google Groups
"OrientDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.