This is an automated email from the ASF dual-hosted git repository. danhaywood pushed a commit to branch CAUSEWAY-3866 in repository https://gitbox.apache.org/repos/asf/causeway.git
commit bdfab6ab34190a410aeccecc650fcc8dac783980 Author: Dan Haywood <[email protected]> AuthorDate: Fri Oct 17 14:04:15 2025 +0100 CAUSEWAY-3866: updates references to javax.persistence --- .../modules/applib-ant/partials/about/jpa.adoc | 6 ++--- .../petclinic/pages/030-petowner-entity.adoc | 4 ++-- .../userguide/modules/ROOT/pages/value-types.adoc | 2 +- .../modules/ROOT/partials/domain-entities/jpa.adoc | 26 ++++++++++++---------- .../ROOT/partials/domain-services/crud.adoc | 12 +++++----- .../modules/ROOT/pages/dependency-injection.adoc | 6 ++--- .../jpa/adoc/modules/ROOT/pages/mapping-guide.adoc | 4 ++-- .../ROOT/pages/setup-and-configuration.adoc | 4 ++-- .../CausewayModulePersistenceJpaEclipselink.java | 2 +- .../jpa/eclipselink/config/ElSettings.java | 1 - 10 files changed, 35 insertions(+), 32 deletions(-) diff --git a/antora/components/refguide/modules/applib-ant/partials/about/jpa.adoc b/antora/components/refguide/modules/applib-ant/partials/about/jpa.adoc index 631fce26214..fcc9f96d1a0 100644 --- a/antora/components/refguide/modules/applib-ant/partials/about/jpa.adoc +++ b/antora/components/refguide/modules/applib-ant/partials/about/jpa.adoc @@ -16,7 +16,7 @@ The table below lists the xref:pjpa:ROOT:about.adoc[JPA/EclipseLink] annotations |Applies to -|xref:refguide:applib-ant:Entity.adoc[@javax.persistence. + +|xref:refguide:applib-ant:Entity.adoc[@jakarta.persistence. + Entity] |Flags that the class is an entity, creating an abstraction layer through which the Causeway framework interacts with the underlying persistent domain object. @@ -40,13 +40,13 @@ Causeway also parses the following JPA annotations, but the metadata is currentl |Applies to -|`@javax.persistence. + +|`@jakarta.persistence. + Transient` |Unused |Persistence |Property -|`@javax.persistence. + +|`@jakarta.persistence. + Table` |Unused |Persistence diff --git a/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc b/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc index c5cc45181d6..df9fc3139ad 100644 --- a/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc +++ b/antora/components/tutorials/modules/petclinic/pages/030-petowner-entity.adoc @@ -889,7 +889,7 @@ mvn -pl webapp spring-boot:run -Dspring-boot.run.jvmArguments="-Dspring.profiles [source,java] .EmailAddress.java ---- [email protected] // <.> [email protected] // <.> @org.apache.causeway.applib.annotation.Value // <.> @lombok.EqualsAndHashCode // <.> public class EmailAddress implements Serializable { // <.> @@ -1033,7 +1033,7 @@ The returned string would appear in URLs or bookmarks, for example. [source,java] .PetOwner.java ---- [email protected] // <.> [email protected] // <.> @Getter @Setter @Property(editing = Editing.ENABLED, optionality = Optionality.OPTIONAL) // <.> @PropertyLayout(fieldSetId = "contact", sequence = "1.2") diff --git a/antora/components/userguide/modules/ROOT/pages/value-types.adoc b/antora/components/userguide/modules/ROOT/pages/value-types.adoc index aea3302f2cd..2173df1b54f 100644 --- a/antora/components/userguide/modules/ROOT/pages/value-types.adoc +++ b/antora/components/userguide/modules/ROOT/pages/value-types.adoc @@ -377,7 +377,7 @@ As we can see, this is not the simplest of APIs, but the simplification it bring We're not quite finished with the glue code, unfortunately. Chances are that you will want to persist the new value to the database, which means that the object store also requires its own SPI to be implemented. -For the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] object store, implement the `javax.persistence.AttributeConverter` SPI. +For the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] object store, implement the `jakarta.persistence.AttributeConverter` SPI. For example: [source,java] diff --git a/antora/components/userguide/modules/ROOT/partials/domain-entities/jpa.adoc b/antora/components/userguide/modules/ROOT/partials/domain-entities/jpa.adoc index 00dc4edc826..c53981d99be 100644 --- a/antora/components/userguide/modules/ROOT/partials/domain-entities/jpa.adoc +++ b/antora/components/userguide/modules/ROOT/partials/domain-entities/jpa.adoc @@ -12,28 +12,30 @@ See the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink object store] documentation fo == Class definition -For the domain class itself, this will be the `@javax.persistence.Entity` annotation and probably the `@javax.persistence.Table` annotation, as well as others to define indices and queries. +For the domain class itself, this will be the `@jakarta.persistence.Entity` annotation and probably the `@jakarta.persistence.Table` annotation, as well as others to define indices and queries. [source,java] ---- [email protected] // <.> [email protected]( - schema= "simple" // <.> +import jakarta.persistence.*; + +@Entity // <.> +@Table( + schema= "simple" // <.> // ... ) -@EntityListeners(CausewayEntityListener.class) // <.> -@Named("simple.SimpleObject") // <.> -@DomainObject // <.> +@EntityListeners(CausewayEntityListener.class) // <.> +@Named("simple.SimpleObject") // <.> +@DomainObject // <.> public class SimpleObject { - @javax.persistence.Id // <.> - @javax.persistence.GeneratedValue(strategy = GenerationType.AUTO) // <3> - @javax.persistence.Column(name = "id", nullable = false) // <.> + @Id // <.> + @GeneratedValue(strategy = GenerationType.AUTO) // <3> + @Column(name = "id", nullable = false) // <.> private Long id; - @javax.persistence.Version // <.> - @javax.persistence.Column(name = "version", nullable = false) // <5> + @Version // <.> + @Column(name = "version", nullable = false) // <5> @PropertyLayout(fieldSetId = "metadata", sequence = "999") @Getter @Setter private long version; diff --git a/antora/components/userguide/modules/ROOT/partials/domain-services/crud.adoc b/antora/components/userguide/modules/ROOT/partials/domain-services/crud.adoc index 862077f3cf7..b030ce9a3f1 100644 --- a/antora/components/userguide/modules/ROOT/partials/domain-services/crud.adoc +++ b/antora/components/userguide/modules/ROOT/partials/domain-services/crud.adoc @@ -168,22 +168,24 @@ public interface UserRepository extends Repository<User, Long> { and Spring Data will create an implementation based on naming conventions. See the link:https://docs.spring.io/spring-data/jpa/docs/current/reference/html/#reference[Spring Data] documentation for further details. -It is also possible to declare JPQL queries , either on the repository method (using `javax.persistence.Query`) or on the entity (using `javax.persistence.NamedQuery`). +It is also possible to declare JPQL queries , either on the repository method (using `jakarta.persistence.Query`) or on the entity (using `jakarta.persistence.NamedQuery`). On the entity, declare a named query, eg: [source,java] ---- [email protected] [email protected]({ - @javax.persistence.NamedQuery( // <.> +import jakarta.persistence.*; + +@Entity +@NamedQueries({ + @NamedQuery( // <.> name = "Customer.findByNameLike", // <.> query = "SELECT c " + // <.> "FROM Customer c " + // <.> "WHERE c.name LIKE :name" // <.> ) }) -... +// ... public class Customer { // ... } diff --git a/persistence/jpa/adoc/modules/ROOT/pages/dependency-injection.adoc b/persistence/jpa/adoc/modules/ROOT/pages/dependency-injection.adoc index 183ad712bb6..1c5da1dc2dc 100644 --- a/persistence/jpa/adoc/modules/ROOT/pages/dependency-injection.adoc +++ b/persistence/jpa/adoc/modules/ROOT/pages/dependency-injection.adoc @@ -9,9 +9,9 @@ For JPA, this requires that the following boilerplate: [source,java] ---- -import javax.persistence.EntityListeners; -import org.apache.causeway.persistence.jpa.applib.integration.JpaEntityInjectionPointResolver; +import jakarta.persistence.EntityListeners; +import org.apache.causeway.persistence.jpa.applib.integration.CausewayEntityListener; -@EntityListeners(JpaEntityInjectionPointResolver.class) +@EntityListeners(CausewayEntityListener.class) public class SomeEntity ... { /* ... */ } ---- diff --git a/persistence/jpa/adoc/modules/ROOT/pages/mapping-guide.adoc b/persistence/jpa/adoc/modules/ROOT/pages/mapping-guide.adoc index d399210714c..791e9ec041b 100644 --- a/persistence/jpa/adoc/modules/ROOT/pages/mapping-guide.adoc +++ b/persistence/jpa/adoc/modules/ROOT/pages/mapping-guide.adoc @@ -162,7 +162,7 @@ public class MyEntity ... { <.> the property as it is understood by Apache Causeway. -TIP: if you have multiple instancs of an `@Embedded` type, the `@javax.persistence.AttributeOverrides` and `@javax.persistence.AttributeOverride` provide a standardised way of fine-tuning the column definitions. +TIP: if you have multiple instancs of an `@Embedded` type, the `@jakarta.persistence.AttributeOverrides` and `@jakarta.persistence.AttributeOverride` provide a standardised way of fine-tuning the column definitions. ==== Clobs @@ -191,4 +191,4 @@ public class MyEntity ... { <.> the property as it is understood by Apache Causeway. -TIP: if you have multiple instances of an `@Embedded` type, the `@javax.persistence.AttributeOverrides` and `@javax.persistence.AttributeOverride` provide a standardised way of fine-tuning the column definitions. +TIP: if you have multiple instances of an `@Embedded` type, the `@jakarta.persistence.AttributeOverrides` and `@jakarta.persistence.AttributeOverride` provide a standardised way of fine-tuning the column definitions. diff --git a/persistence/jpa/adoc/modules/ROOT/pages/setup-and-configuration.adoc b/persistence/jpa/adoc/modules/ROOT/pages/setup-and-configuration.adoc index 789209cfb0c..456d03f85ac 100644 --- a/persistence/jpa/adoc/modules/ROOT/pages/setup-and-configuration.adoc +++ b/persistence/jpa/adoc/modules/ROOT/pages/setup-and-configuration.adoc @@ -74,11 +74,11 @@ is set to `false` + is set to `create-or-extend-tables` -* `javax.persistence.bean.manager` +* "jakarta.persistence.bean.manager" + is set to an Apache Causeway implementation, to assist with dependency injection into entities. -Generally these should not be changed, though if there is a requirement, then provide a subclasse alternate implementation of `org.apache.causeway.persistence.jpa.eclipselink.config.ElSettings` with an earlier `@Priority` precedence. +Generally these should not be changed, though if there is a requirement, then provide an alternate implementation of `org.apache.causeway.persistence.jpa.eclipselink.config.ElSettings` with an earlier `@Priority` precedence. To set other EclipseLink configuration properties, use a subclass of xref:refguide:persistence:index/jpa/eclipselink/CausewayModulePersistenceJpaEclipselink.adoc[] and override `getVendorProperties()`. diff --git a/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/CausewayModulePersistenceJpaEclipselink.java b/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/CausewayModulePersistenceJpaEclipselink.java index e7a68cdf9aa..29c8df92492 100644 --- a/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/CausewayModulePersistenceJpaEclipselink.java +++ b/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/CausewayModulePersistenceJpaEclipselink.java @@ -179,7 +179,7 @@ public DataAccessException translateExceptionIfPossible(final RuntimeException e if(translatedEx!=null) return translatedEx; } - /* (null-able) converts javax.persistence exceptions to Spring's hierarchy + /* (null-able) converts jakarta.persistence exceptions to Spring's hierarchy * However, don't let * org.springframework.orm.jpa.EntityManagerFactoryUtils.convertJpaAccessExceptionIfPossible(RuntimeException) * translate those 2 generic ones ... */ diff --git a/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/config/ElSettings.java b/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/config/ElSettings.java index 6d5a1d95eab..dc0d8f08c46 100644 --- a/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/config/ElSettings.java +++ b/persistence/jpa/eclipselink/src/main/java/org/apache/causeway/persistence/jpa/eclipselink/config/ElSettings.java @@ -72,7 +72,6 @@ protected Map<String, Object> createMap() { // setup defaults jpaProps.put(PersistenceUnitProperties.WEAVING, "false"); - //jpaProps.put(PersistenceUnitProperties.LOGGING_LEVEL, SessionLog.FINER_LABEL); //debug logging jpaProps.put(PersistenceUnitProperties.DDL_GENERATION, PersistenceUnitProperties.CREATE_OR_EXTEND); jpaProps.put(PersistenceUnitProperties.CDI_BEANMANAGER, new BeanManagerForEntityListeners(serviceInjectorProvider));
