This is an automated email from the ASF dual-hosted git repository. ntimofeev pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/cayenne.git
The following commit(s) were added to refs/heads/master by this push: new 073ac1939 Upgrade guide for 5.0-M1 073ac1939 is described below commit 073ac1939f96f8e9ddacd2e4dbcae2045ff764e1 Author: Nikita Timofeev <stari...@gmail.com> AuthorDate: Wed Sep 11 12:46:51 2024 +0400 Upgrade guide for 5.0-M1 --- .../src/docs/asciidoc/_upgrade-guide/changes.adoc | 74 ++++++++++++++++++++++ .../docs/asciidoc/_upgrade-guide/new-features.adoc | 54 ++++++++++++++-- .../src/docs/asciidoc/upgrade-guide.adoc | 2 +- 3 files changed, 125 insertions(+), 5 deletions(-) diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/changes.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/changes.adoc new file mode 100644 index 000000000..2ffa5de97 --- /dev/null +++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/changes.adoc @@ -0,0 +1,74 @@ +// Licensed to the Apache Software Foundation (ASF) under one or more +// contributor license agreements. See the NOTICE file distributed with +// this work for additional information regarding copyright ownership. +// The ASF licenses this file to you under the Apache License, Version +// 2.0 (the "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 Unless required by +// applicable law or agreed to in writing, software distributed under the +// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR +// CONDITIONS OF ANY KIND, either express or implied. See the License for +// the specific language governing permissions and limitations under the +// License. + +== Java Version + +Minimum required JDK version is 11 or newer. If your project requires Java 8, you should keep using Cayenne 4.2. +Cayenne 5.0 is fully tested with Java 11, 17 and 21. + +== Incompatible Changes + +Apache Cayenne 5.0-M1 removes support for a multi-layered stack, so no more Cayenne ROP and all the related client parts. +Moreover, this release renames every part that contains `server` in its name, including the main library. +For all the details please consult `UPGRADE.txt`, as this document only highlights the most impactful changes. + +=== Main Library Renaming + +Main Cayenne artifact is renamed from `cayenne-server` to `cayenne`, so you need to change your dependencies accordingly + +[source,xml] +---- +<dependency> + <groupId>org.apache.cayenne</groupId> + <artifactId>cayenne</artifactId> + <version>{version}</version> +</dependency> +---- + +=== Server Runtime and Module Deprecation + +`ServerRuntime` is deprecated and replaced by `CayenneRuntime`. As well as `ServerModule` renamed to `CoreModule`. + +[source,java] +---- +CayenneRuntime runtime = CayenneRuntime.builder() + .addConfig("cayenne-project.xml") + .module(b -> CoreModule.extend(b).setProperty("some_property", "some_value")) + .build(); +---- + +=== New Modules Extenders + +Each Cayenne module now provides a module-specific extender created with an "extend(Binder)" method. +It is usually invoked within a lambda that produces a Module, or within an app Module. + +[source,java] +---- +CayenneRuntime.builder(..) + .addModule(b -> CacheInvalidationModule.extend(b).addHandler(MyHandler.class)) + .build(); +---- + +=== Removal of Deprecated Modules + +- All modules related to the ROP functionality is completely gone. +That includes `cayenne-rop-server`, `cayenne-client` and other related parts. +- `cayenne-xmpp`, `cayenne-jms` and `cayenne-jgroups` event bridges are removed. +- Finally `cayenne-joda` and `cayenne-web` modules are gone. + +=== Removal of Deprecated Code + +As always, code deprecated in earlier versions is gone. One notable class removed is `SelectQuery`, so you should use `ObjectSelect` from now on. + + diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc index 5bccf3426..88a45695a 100644 --- a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc +++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/_upgrade-guide/new-features.adoc @@ -12,10 +12,56 @@ // the specific language governing permissions and limitations under the // License. -== Java Version +== New Features -Minimum required JDK version is 11 or newer. -Cayenne 5.0 is fully tested with Java 11, 17 and 21. +=== New Dev Versioning Scheme -== New Features +From now on a snapshot version of Cayenne is a constant value, so the dev version of 5.0 will always be 5.0-SNAPSHOT. +So you can always stay at the bleeding edge of development if needed. + +[source,xml] +---- +<dependency> + <groupId>org.apache.cayenne</groupId> + <artifactId>cayenne</artifactId> + <version>5.0-SNAPSHOT</version> +</dependency> +---- + +=== New Class Generation UI + +The new Class Generation UI in the Cayenne Modeler simplifies configuration, allows multiple `cgen` setups per project, +and includes a template editor. + +Custom templates are now part of the project XML configuration and don't require separate setup in either Modeler, or Maven/Gradle plugins. + +=== Improved `(not)exists` Queries + +In most cases, you don’t need to deal with a subquery for `(not)exists` queries, as it is now directly supported by the Expression API. +That includes `Expression`, expression parser, and Property API. + +This feature can handle any expression and spawn several sub-queries per expression if needed. + +[source,java] +---- +long count = ObjectSelect.query(Artist.class) + .where(Artist.PAINTING_ARRAY.dot(Painting.PAINTING_TITLE).like("painting%").exists()) + .selectCount(context); +---- + +=== Improved SQL Support + +`ANY` and `ALL` subqueries are now supported, as well as `case-when` expressions. + +[source,java] +---- +import static org.apache.cayenne.exp.ExpressionFactory.*; +// ... +Expression caseWhenExp = caseWhen( + List.of((betweenExp("estimatedPrice", 0, 9)), + (betweenExp("estimatedPrice", 10, 20))), + List.of((wrapScalarValue("low")), + (wrapScalarValue("high"))), + wrapScalarValue("error")); +---- diff --git a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc index fe8c4a1dd..d4092d050 100644 --- a/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc +++ b/docs/asciidoc/upgrade-guide/src/docs/asciidoc/upgrade-guide.adoc @@ -34,8 +34,8 @@ a copy of the License at https://www.apache.org/licenses/LICENSE-2.0_# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License._# - This guide highlights the new features and changes introduced in Apache Cayenne 5.0. For a full list of changes consult RELEASE-NOTES.txt included in Cayenne download. For release-specific upgrade instructions check UPGRADE.txt. +include::_upgrade-guide/changes.adoc[] include::_upgrade-guide/new-features.adoc[] \ No newline at end of file