Closed oleksandrzakharov closed 4 years ago
We have to clarify this internally. I know that this came up about a year ago but need to find the discussion again.
Thanks, @oleksandrzakharov for your patience here.
This is fixed in master and will be available from at least OGM 3.2.4 onwards, I'll have a look now whether we back port it to 3.1.x, too.
Will be in 3.1.16 as well.
Thank you very much!!!
LoadStrategy.SCHEMA_LOAD_STRATEGY
It was saved, teacher(with two labels: Teacher, Person), course(Course), (:COURSE). In database evething is correct
id(teacher) ==> 1
Expected Behavior
After save in another session I can read
Neo4jSession session;
session.load(Person.class, 1)
==> Teacher with the course. Type of the java class is correct. The cypher query should have the relationship (:COURSE) in the cypher query with course nodeCurrent Behavior
Neo4jSession session;
session.load(Person.class, 1)
==> Teacher without the course (only values from Person). Type of the java class is correct. In the cypher query, the relationship does not existPossible Solution
With LoadStrategy.PATH_LOAD_STRATEGY (
MATCH p=(n)-[*0..1]-(m) RETURN p
) it works, but it is not the default behaviour, not compliant with load based on a schema. When loading for exampleLoadOneDelegate.class
instead ofpublic <T, ID extends Serializable> T load(Class<T> type, ID id, int depth) {
load labels from the entity
MATCH (n) where id(n) = {id} RETURN labels(n)
and build tree of inherentence and after that build a query => exact call => mappingContext
Using spring repositories I can do like:
public interface PersionRepository extends Neo4JRepository<Person, Long> { }
but if I have child-parent it is not possible to extract values from a child using parent type. For example in JPA it worksYour Environment