Jun 19th, 2012, 08:50 AM
[Neo4j] Can I use SDN POJOs (aspects) in an EJB 3.1 remote client?
I would like to reuse my domain objects in the remote client of an EJB 3.1 application instead of using data transfer objects. When I have attempted to send an SDN POJO, it arrives as empty and I see the ominous error message:
ERROR org.springframework.data.neo4j.aspects.support.nod e.Neo4jNodeBacking - entityStateFactory not set, not creating accessors for class com.ejb31.domain.Person
in the log output on the client. Of course, I don't intend to perform CRUD calls on the POJOs on the client, I would just like the getters (accessors) to return data. How can I configure SDN on the client to avoid the above error?
I am using SDN 2.1.0.BUILD-SNAPSHOT and Neo4j 1.7 in the application server (JBoss AS7).
Jun 20th, 2012, 11:23 AM
Do you transfer your objects over the wire?
I don't think serialization/deserialization is handled correctly there.
The entityStateFactory only gets set at construction not at readResolve, or readObject. The problem is also as in AspectJ mode the getters and setters are a live view of the graph, that there would have to be a additional operation to pull the data out of the graph for serialization (aka creating the hydrated DTO under the hood).
In general I would for the read-case go with concrete and use-case oriented DTO objects which can be filled by using cypher queries on the graph.
Jun 20th, 2012, 12:15 PM
Yes, they are being sent over the wire. I've found that I can reuse my SDN POJOs as long as I clone the 'live' ones (so then I have detached copies), before sending the clones over the wire. However, sending the clones results in the same entityStateFactory error message but the data is there.
Jun 21st, 2012, 02:37 PM
There is already a JIRA issue for this but it hasn't been tackled so far.
Please watch the issue to see when it is worked on.