-
Notifications
You must be signed in to change notification settings - Fork 616
Treat no attributes annotated with @ConvertedWith
as association.
#2168
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Would you mind sharing your |
|
Thanks. I just wanted to make sure that this is the reason for your issues. So the problem is you cannot use
using like this
this will however generate a prefix, which is inline with Neo4j-OGM's |
Here's test code for the example above DomainOne domainOne = new DomainOne();
domainOne.setCustomConverterDefaultPrefix(new DomainTwo(true, 4711L));
domainOne = domainOneRepository.save(domainOne);
try (Session session = driver.session()) {
Node node = session
.run("MATCH (n:DomainOne {id: $id}) RETURN n", Collections.singletonMap("id", domainOne.getId()))
.single().get(0).asNode();
assertThat(node.get("customConverterDefaultPrefix.aBooleanValue").asBoolean()).isTrue();
assertThat(node.get("customConverterDefaultPrefix.aLongValue").asLong()).isEqualTo(4711L);
} |
Thanks so much! I'll give this a try! |
@ConvertedWith
as association.
…ciation. The actuall issue here is caused by `@ConvertedWith` not indicating at all times that a property isn't an association: The moment there is a converter (either through the Spring context or `@ConvertedWith`) it can't be an association anymore. The exception `Required identifier property not found for class` was thrown because SDN treated the annotated property as association. This is fixed now. The commit adds tests for this and also adds an example how to use composite or discrete property convertes. However, in alignment with previous SDN+OGM behavior, a prefixless decomposition of properties into maps and composition back from them is not possible. This closes #2168.
Please have a look at this test https://github.com/spring-projects/spring-data-neo4j/blob/master/src/test/java/org/springframework/data/neo4j/integration/issues/gh2168/Gh2168IT.java#L65-L118 added via 1fb0945 thank you! |
With 6.0.5, I'm trying to work through some OGM-to-SDN migration, and I think I may have come across an issue with
@ConvertWith
, but I'm not sure if my usage is correct or not.I have a repository test that tests a
findById
method, but as the test spins up and sets up I get an error:java.lang.IllegalStateException: Required identifier property not found for class ...
The generalized code:
The text was updated successfully, but these errors were encountered: