Commit Graph

1874 Commits

Author SHA1 Message Date
Michael Simons
d8bff18b22 refactor: Avoid all usage of Neo4j id() function unless required by the users datamodel.
This change makes use of the Cypher-DSL dialect capatibilities and uses a String identifier internally for all objects. This will be the `elementId()` on Neo4j 5 and higher and `toString(id())` on Neo4j 4 and lower.

Unless explicitly configured by the user through having `@Id @GeneratedValue long id`, we don’t use the `id()` function anymore. This function has been deprecated in Neo4j 5.

Users are encouraged to use `@Id @GeneratedValue String id` for assigning the element id as object id or using custom unique identifiers or `@Id @GeneratedValue UUID id` or  `@Id @GeneratedValue(value = UUIDStringGenerator.class) String id` for UUIDs.

We marked the long ids as deprecated, but don’t have any plans for now to remove them, so that future SDN versions will still be compatible with older Neo4j versions if the data model contains long ids.

We opted for using String’s directly to avoid tons of additional instances and rely on the JVMs excellent String caching capatiblities, thus, the `ElementId` interface - not usable so far anyhow - has been removed without current or planned replacement.

See #2716 and other tickets, closes #2718.
2023-05-04 16:01:33 +02:00
Gerrit Meier
fca0a9af69 Upgrade Neo4j driver to 5.8.0. 2023-05-02 11:41:09 +02:00
Michael Simons
743c966ce6 refactor: Disable tests related to dynamic labels on older Neo4j versions. 2023-04-28 16:01:49 +02:00
Michael Simons
b2fea935eb build: Change libs-snapshot and libs-milestone repo definition to the none prefixed ones.
See https://spring.io/blog/2020/10/29/notice-of-permissions-changes-to-repo-spring-io-fall-and-winter-2020
2023-04-28 15:52:37 +02:00
Oliver Drotbohm
2443f22d95 Adapt to ScrollPosition API changes in Spring Data Commons.
Fixes #2714.
Related ticket: #2824.
2023-04-27 20:37:06 +02:00
Greg L. Turnquist
51ac921de5 After release cleanups.
See #2695
2023-04-14 12:00:01 -05:00
Greg L. Turnquist
f2c744ee75 Prepare next development iteration.
See #2695
2023-04-14 11:59:55 -05:00
Greg L. Turnquist
3d9db0ea64 Release version 7.1 RC1 (2023.0.0).
See #2695
2023-04-14 11:53:58 -05:00
Greg L. Turnquist
59adab8756 Prepare 7.1 RC1 (2023.0.0).
See #2695
2023-04-14 11:53:19 -05:00
Gerrit Meier
ba26268469 Upgrade Neo4j driver to 5.7.0. 2023-04-11 14:41:31 +02:00
Michael Simons
8c05a6bfee refactor: Add support for OffsetDateTime and LocalTime properties.
Recent drivers support them without issues and don’t need separate conversions. Closes #2706.
2023-04-11 13:32:34 +02:00
Michael Simons
4fc80a3d90 fix: Assume Values.NULL in all cases where id values are literal null.
Closes #2710
2023-04-11 12:16:22 +02:00
Mark Paluch
9c9baaf3aa Adopts tests to changes in Spring Framework.
See #2695
2023-04-06 17:18:03 +02:00
Mark Paluch
c5cc6e676d Upgrade to Maven Wrapper 3.9.1.
See #2707
2023-04-06 16:16:22 +02:00
Gerrit Meier
74a253de6a Add Neo4j 5.x as test harness supported.
This is still the same as with 4.x, thus we just
mention it in the combination with 4.x to avoid
any upcoming questions.
2023-04-05 17:55:00 +02:00
Greg L. Turnquist
5a5373311d Test against Java 20 on CI.
See #2701.
2023-04-04 10:01:28 -05:00
Oliver Drotbohm
55337dec4d Move off deprecated methods of PersistenPropertyPath.
Fixes #2705.
2023-04-04 11:29:17 +02:00
Michael Simons
c31bd5d7b0 GH-2704 - Always define __relationships__ parameter.
In #2668 storing of relationships has been optimised so that existing relationships are not always refetched. The new query always requires `__relationships__` to be present. In the case of relationships with defined properties, `Neo4jMappingContext#createStatementForRelationshipWithPropertiesBatch` only defines that argument for new relationships, so updating relationships with properties fails.

Closes #2704
2023-03-31 11:41:41 +02:00
Michael Simons
02752f2bba GH-2703 - Add support for negating transformers to query-by-example.
Closes #2703.
2023-03-30 12:46:57 +02:00
Greg L. Turnquist
3b1635537a Update CI properties.
See #2695
2023-03-28 13:58:17 -05:00
Michael Simons
8e1f6b7827 GH-2699 - Upgrade Java Driver to 5.6.0.
Closes #2699.
2023-03-22 15:55:39 +01:00
Michael Simons
18bc92db29 GH-2698 - Upgrade CypherDSL to 2023.2.0.
Closes #2698.
2023-03-22 15:55:39 +01:00
Gerrit Meier
d9a35eece6 Support relationships in find by example.
It's possible now to also define fields in the relationships
to query for by example.
This commit advances the functionality of the PropertyPathWrapper class
to also cater for the needs of the Predicate created by the example
instance(s).

Closes #2696
2023-03-22 14:11:28 +01:00
Christoph Strobl
4c655390cf After release cleanups.
See #2675
2023-03-20 15:05:35 +01:00
Christoph Strobl
1cf34886cf Prepare next development iteration.
See #2675
2023-03-20 15:05:33 +01:00
Christoph Strobl
6046809e10 Release version 7.1 M3 (2023.0.0).
See #2675
2023-03-20 15:01:47 +01:00
Christoph Strobl
16651e536e Prepare 7.1 M3 (2023.0.0).
See #2675
2023-03-20 15:01:19 +01:00
Michael Simons
64854c5155 GH-2692 - Add basic support for keyset based pagination and scrolling.
Discussed in https://github.com/spring-projects/spring-data-commons/issues/2151 and implemented in https://github.com/spring-projects/spring-data-commons/pull/2787 we can build on top and provide basic support for both imperative and reactive repositories.

The support will be available only on the repository level in the first iteration, think

```java
import java.util.UUID;

import org.springframework.data.domain.ScrollPosition;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Window;
import org.springframework.data.neo4j.repository.Neo4jRepository;

public interface ScrollingRepository extends Neo4jRepository<ScrollingEntity, UUID> {
	Window<ScrollingEntity> findTop4By(Sort sort, ScrollPosition position);
}
```

and other derived finder methods that have a limit and a stable sort.

If requested, further support can be added to the templates, too.

Closes #2691.
2023-03-20 11:04:29 +01:00
Michael Simons
97c7b5b9d4 GH-2687 - Remove -Werror switch.
Will require a bit more diligence checking the looks, but it helps the Spring Data team and closes #2687.
2023-03-02 12:19:45 +01:00
Gerrit Meier
5b6b24df10 GH-2685 - Fix delete query method with relationships.
Previously relationship related properties in the query method were
missing in the MATCH part but the condition would get applied.
This created an incorrect query string and failed on the server side.

Non-invasive change to avoid regression in the other parts.

Closes #2685
2023-03-01 09:41:55 +01:00
Gerrit Meier
957284edb8 GH-2681 - Sanitize label replacements.
This requires an update of the CypherDSL to use the built-in
function instead of copying code.
2023-02-28 14:18:07 +01:00
Michael Simons
5b6cb19c53 GH-2684 - Make Neo4j templates safer to use outside an application context.
While still not recommended to use outside an application context, this allows basic usage.

Closes #2684.
2023-02-23 20:02:36 +01:00
Gerrit Meier
233421c08a GH-2683 - Use identityHashCode in save operations.
Relying on equals/hashCode in the domain entity can lead into situations
where a existing object cannot found anymore because its hashCode value
has changed. e.g. generated id or version attribute.
Using the raw `System.identityHashCode` solves this problem.
This code also simplifies the overall usage of caching properties and
reduces the storage of object references into one central place.

Closes #2683
2023-02-23 15:44:35 +01:00
Gerrit Meier
22c1d23fd7 GH-2681 - Upgrade Neo4j container to 5. 2023-02-22 14:38:21 +01:00
Gerrit Meier
3667fb5588 GH-2681 - Add anyOf / allOf to SpEL.
Currently we only have the literals clause to render an arbitrary string into a custom Cypher statement.
Although one could prepare the string upfront manually and joining multiple strings on | or &
and pass this to the query method, it would be more convenient to add one or two functions directly.

Namely those functions will be
anyOf : renders input ["a","b", ..] to A|B|..
allOf : renders input ["a","b", ..] to A&B&..
The usage would be MATCH (n::#{allOf(#labels)}) RETURN n, for example.

Closes #2681
2023-02-22 14:38:21 +01:00
Mark Paluch
7b30ecf72f Upgrade to Maven Wrapper 3.9.0.
See #2677
2023-02-20 11:58:05 +01:00
Christoph Strobl
f8addd5517 After release cleanups.
See #2674
2023-02-17 14:25:48 +01:00
Christoph Strobl
85ab11e105 Prepare next development iteration.
See #2674
2023-02-17 14:25:46 +01:00
Christoph Strobl
2f6bcb4971 Release version 7.1 M2 (2023.0.0).
See #2674
2023-02-17 14:22:31 +01:00
Christoph Strobl
2516c9208c Prepare 7.1 M2 (2023.0.0).
See #2674
2023-02-17 14:22:17 +01:00
Christoph Strobl
3531602dd9 After release cleanups.
See #2631
2023-02-17 13:31:54 +01:00
Christoph Strobl
fec956c098 Prepare next development iteration.
See #2631
2023-02-17 13:31:52 +01:00
Christoph Strobl
c6c0881caa Release version 7.1 M1 (2023.0.0).
See #2631
2023-02-17 13:27:49 +01:00
Christoph Strobl
f8310ef0f3 Prepare 7.1 M1 (2023.0.0).
See #2631
2023-02-17 13:27:07 +01:00
Mark Paluch
e86cc2f029 GH-2671 - Migrate off deprecated Parameters API.
Migrate to newly introduced constructors and methods to consider the relationship between the domain type and Class<?> parameters to distinguish between projection parameters and bindable class parameters.

Closes #2671
2023-02-16 08:46:29 +01:00
Gerrit Meier
4a2282c584 GH-2669 - Don't query for internally generated id.
This is unnecessary because the property itself won't exist in this case,
but only id(node).
More visible now because Neo4j 5+ logs unknown property querying.

Closes #2669
2023-02-14 13:53:34 +01:00
Michael Simons
28e051b539 GH-2621: Recursively apply DtoInstantiating converter for fluent ops. (#2667)
This allows to use Dto based projections to be used in a nested fashion when using the fluent save operations.

This does not solve - or attempt to solve - the issue that we don’t have any information what concrete projection class to be used when projection in all cases.

In the test `nestedProjectWithFluentOpsShouldWork` we could argue that the concrete value can be used to determine the type information. However, while that can be made to work with heterogeneous collections, it would bring a big performance penalty, getting new persistent entity instances and property accessors all the time.

Thus, this change now makes sure no exception is thrown when using such inherited projections, but does explicitly not bring support for deriving the projected properties from them accross an inheritance hierachy.

For more information, please read the comments in org.springframework.data.neo4j.integration.imperative.ProjectionIT#nestedProjectWithFluentOpsShouldWork and org.springframework.data.neo4j.integration.imperative.ProjectionIT#nestedProjectWithFluentOpsShouldWork2.

This closes #2621.
2023-02-10 09:41:37 +01:00
Gerrit Meier
1d21803d52 GH-2668 - Optimise update of relationship properties.
There is no need to fetch start and end node if we already have the
identifier of the relationship to update.

Closes #2668
2023-02-10 08:07:32 +01:00
Michael Simons
be0ab1258e docs: Remove broken images README.adoc 2023-02-09 11:40:10 +01:00
Gerrit Meier
68e0fe43a8 Fix projection method in documentation.
Also add the reason behind the wording.
2023-02-02 11:33:21 +01:00