Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CompoundIdentity is not supported #30

Open
dhakehurst opened this issue Apr 18, 2017 · 2 comments
Open

CompoundIdentity is not supported #30

dhakehurst opened this issue Apr 18, 2017 · 2 comments

Comments

@dhakehurst
Copy link

version: 5.1.0-m1
test case: https://github.com/dhakehurst/test-jdo, SimpleTest.CompoundIdentity()

Error from stacktrace indicates a badly formed CYPHER statement

"START pc=node:DN_TYPES(class="mydomain.model.CompoundItem") WHERE (pc.id = "item1" and pc.owner = cont1) RETURN pc"

maybe missing quotes around the "cont1".

I think that the problem might be the if statement at line 193 of Neo4jUtils.
it tests if the storedValue is an instance of a String, and inserts quotes if so, else no quotes.
However, in the case of the compound PK, the PK is stored as a String (I think).

So an additional test to catch the PK case needs to be added.
Am not sure how to test for the PK case, happy to provide a patch if I can get some advice.

@dhakehurst
Copy link
Author

possible patch

replace line 193:
if (storedValue instanceof String)
with:
if (storedValue instanceof String || !cmd.usesSingleFieldIdentityClass())

this enables the compound identity to work, but not sure if it breaks any other situations
it shouldn't do, but I don't have a large test suit to check it on.

@andyjefferson
Copy link
Member

That is not a possible patch because a relation field is not stored as a Neo4j "property", instead as a Relation, as per https://github.com/datanucleus/datanucleus-neo4j/blob/master/src/main/java/org/datanucleus/store/neo4j/fieldmanager/StoreFieldManager.java#L417 . Consequently to check for existence of an object which has a relation as a PK field then you will need to do a different query, and cannot simply check on properties.

@andyjefferson andyjefferson changed the title CompoundIdentity does not work CompoundIdentity is not supported Jun 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants