You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expected behavior:
The OAfterDeserialization callback should be invoke after unmarshalling. As per http://orientdb.com/docs/2.2/Object-2-Record-Java-Binding.html:
"@OAfterDeserialization called just AFTER unmarshalling the object from the source record"
Actual behavior:
The OAfterDeserialization defined callback is never called.
Steps to reproduce the problem
Please see code below to reproduce.
public class Main {
public static class Foo {
@Id
private String id;
public Foo() {
}
public String getId() {
return id;
}
@OAfterDeserialization
public void fromStream(final ODocument iDocument) {
System.out.println("here in fromStream");
}
@OBeforeSerialization
public void toStream(final ODocument iDocument) {
System.out.println("here in toStream");
}
}
private static void doIt() throws IOException {
String dbUser = "root";
String dbPass = "root";
String dbUrl = "remote:localhost:2424/foo";
OServerAdmin serverAdmin = new OServerAdmin(dbUrl);
serverAdmin.connect(dbUser, dbPass);
if (serverAdmin.existsDatabase("plocal")) {
serverAdmin.dropDatabase("plocal");
}
serverAdmin.createDatabase("document", "plocal");
ODatabaseDocumentTx databaseDocumentTx = new ODatabaseDocumentTx(dbUrl);
databaseDocumentTx.open(dbUser, dbPass);
OObjectDatabaseTx objectDatabaseTx = new OObjectDatabaseTx(databaseDocumentTx);
objectDatabaseTx.setAutomaticSchemaGeneration(true);
objectDatabaseTx.getEntityManager().registerEntityClass(Foo.class);
ORecordId rid = null;
{
Foo foo = new Foo();
System.out.println("about to serialize");
foo = objectDatabaseTx.save(foo);
System.out.println("finished serializing foo:" + foo.getId());
rid = new ORecordId(foo.getId());
}
{
System.out.println("about to deserialize");
Foo foo = objectDatabaseTx.load(rid);
System.out.println("finished deserializing foo:" + foo.getId());
}
}
public static void main(String[] args) {
try {
doIt();
} catch (IOException e) {
e.printStackTrace();
}
}
}
The actual output was:
about to serialize
here in toStream
finished serializing foo:#33:0
about to deserialize
finished deserializing foo:#33:0
The expected out was:
about to serialize
here in toStream
finished serializing foo:#33:0
about to deserialize here in fromStream
finished deserializing foo:#33:0
The text was updated successfully, but these errors were encountered:
OrientDB Version, operating system, or hardware.
Operating System
Expected behavior and actual behavior
Expected behavior:
The OAfterDeserialization callback should be invoke after unmarshalling. As per http://orientdb.com/docs/2.2/Object-2-Record-Java-Binding.html:
"@OAfterDeserialization called just AFTER unmarshalling the object from the source record"
Actual behavior:
The OAfterDeserialization defined callback is never called.
Steps to reproduce the problem
Please see code below to reproduce.
public class Main {
}
The actual output was:
about to serialize
here in toStream
finished serializing foo:#33:0
about to deserialize
finished deserializing foo:#33:0
The expected out was:
about to serialize
here in toStream
finished serializing foo:#33:0
about to deserialize
here in fromStream
finished deserializing foo:#33:0
The text was updated successfully, but these errors were encountered: