Neo4j OGM allows to configure "use-strict-querying", see https://github.com/neo4j/neo4j-ogm/issues/651. For now, there is no easy way to configure this option using Spring Boot. It would be nice to have a property "spring.data.neo4j.use-strict-querying" as implemented for other properties like uri, username, password or auto-index. See Neo4jDataAutoConfiguration
and Neo4jProperties
.
There are also other properties I would like to see easily configurable, for example "useNativeTypes". See org.neo4j.ogm.config.Configuration.Builder
for what's currently available.
Workaround/hack using reflection:
@Bean
public SessionFactory sessionFactory(org.neo4j.ogm.config.Configuration configuration)
throws IllegalAccessException {
FieldUtils.writeDeclaredField(configuration, "useStrictQuerying", Boolean.TRUE, true);
SessionFactory sessionFactory = new SessionFactory(configuration, "com.example");
return sessionFactory;
}
Comment From: wilkinsona
Neo4j OGM allows to configure "use-strict-querying"
Thanks for the suggestion. I think we'd also need to consider use-relaxed-querying
as well, particularly as strict querying will become the default in 4.0 and users may want to switch back to relaxed.
@michael-simons Would a spring.data.neo4j.querying
property that takes a enum with STRICT
and RELAXED
values make sense here? We could default to RELAXED
and then, when we upgrade to 4.0, flip the default to STRICT
.
There are also other properties I would like to see easily configurable, for example "useNativeTypes"
With thanks to @michael-simons , we added the spring.data.neo4j.use-native-types
property for this in Spring Boot 2.2.
Comment From: michael-simons
Thanks for looping us in, Andy!
The enum
would be nice, yes.
Regarding the flip to 4.0: We have a bigger PR incoming in regards of SDN 6. That property will not be needed anymore (or supported, as a matter of fact).
Comment From: wilkinsona
Thanks, Michael. Will SDN 6 be part of Spring Data 2020.0 (Ockham)? Boot 2.4 will ship with Spring Data 2020.0 so there may be no point in us adding a querying
property only to need to remove it again during 2.4's development when SDN 6 lands.
Comment From: michael-simons
Yes. Also: Agree.
Comment From: wilkinsona
Thanks, @michael-simons. Ok, let's keep this one open for now. We can use it to remind us to revisit the configuration properties that we provide and to make sure they we've covered everything that we want to cover once the SDN 6 upgrade has happened
Comment From: wilkinsona
I've labelled this as a task for now. It may become an enhancement if we identify some changes that we'd like to make.
Comment From: snicoll
@michael-simons I don't think there is anything left here given that OGM has been removed in Spring Data Neo4j 6. Do you agree?
Comment From: michael-simons
Correct.
Comment From: snicoll
@steffen-harbich-itc I am going to close this now. For upgrade instructions, please check the Spring Data Neo4j project.