neo4j / neo4j-ogm

Java Object-Graph Mapping Library for Neo4j
https://neo4j.com/docs/ogm-manual/
Apache License 2.0
337 stars 165 forks source link

Ogm Filter for ver 3.0.x isn't compatible with filter from earlier version (2.1.x) #432

Closed fairy3 closed 7 years ago

fairy3 commented 7 years ago

In our base libraries we widely use Filters. After upgrading neo4j (from 3.2.0 to 3.3.0) and ogm accordingly (from 2.1.3 to 3.0.1) we found out that constructor Filter(propertyName,propertyValu) doesn't exist anymore.

Now I got a compilation error: Filter filter = new Filter(key, ob)--> The constructor Filter(String, Object) is undefined I would expected that upgrading ogm doesn't cause any compilation issues in our old code.

Possible Solution

I suppose, class Filter must have follow constructor: @Deprecated public Filter(String propertyName, Object propertyValue){ this(propertyName, ComparisonOperator.DEFAULT, propertyValue); } Then we won't have any compilation issues in our base libraries, using Filters.

Possible workaround:

Probably, I could try to change the constructors, but I don't know which one of ComparisonOperator is default in the case.Which one should I use when I try "to find by property"?

Context

We can't upgrade neo4j to a last version (3.3.0), since it requires upgrading ogm to 3.0.0/3.0.1 and upgrading the ogm causes compilation errors in our base libraries.

Your Environment

nmervaillie commented 7 years ago

In this case the replacement of

new Filter(propertyName, propertyValue)

would be

new Filter(propertyName, ComparisonOperator.EQUALS, propertyValue);

Is it something you can deal with, for example by bulk replacing with a regex like these ? new Filter\(([^,]+)\s*,\s*([^\)^,]+)\) replaced by new Filter\($1, ComparisonOperator.EQUALS, $2)

fairy3 commented 7 years ago

Thanks I would suppose that in order to save backward compatibility the follow constructor should be added: public Filter(propertyName,propertyValue) { this(propertyName, ComparisonOperator.EQUALS, propertyValue); }

nmervaillie commented 7 years ago

OGM 3 is a major version, do not expect it to be a drop in replacement. Please check the migration checklists here : https://neo4j.com/docs/ogm-manual/current/migration/#appendix:migration:checklist

fairy3 commented 7 years ago

Ok

nmervaillie commented 7 years ago

There is no version 3.2 or 3.3 for OGM...

frant-hartm commented 7 years ago

Just a summary - we aim to keep the backwards compatibility between minor versions (e.g. 3.0.x and future 3.1.x). Between major versions (2.x.x and 3.x.x) this compatibility is not ensured.

The constructor change happened between major versions - 2.1.x and 3.0.x.