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
The following commit(s) were added to refs/heads/CAUSEWAY-3866 by this push:
new 9b2a3e51f25 CAUSEWAY-3866: updating docs, removing references to JDO
9b2a3e51f25 is described below
commit 9b2a3e51f25a8a58c0f054ce9531e3f847ba00d1
Author: Dan Haywood <[email protected]>
AuthorDate: Wed Oct 15 09:28:00 2025 +0100
CAUSEWAY-3866: updating docs, removing references to JDO
---
.../applib/pages/index/annotation/Optionality.adoc | 4 +-
.../updates/hooks/WithUpdatedAt_usage-notes.adoc | 21 ++-
.../RepositoryService_020-examples-and-usage.adoc | 6 +-
.../modules/ROOT/pages/2020/2.0.0-M4/relnotes.adoc | 2 +-
.../userguide/modules/ROOT/pages/overview.adoc | 2 +-
.../userguide/modules/ROOT/pages/value-types.adoc | 6 +-
.../ROOT/partials/domain-entities/progmodel.adoc | 7 +-
.../properties-collections-actions/properties.adoc | 210 +++++----------------
.../adoc/modules/starters/pages/simpleapp.adoc | 29 +--
.../integtestsupport/pages/hints-and-tips.adoc | 7 -
10 files changed, 82 insertions(+), 212 deletions(-)
diff --git
a/antora/components/refguide-index/modules/applib/pages/index/annotation/Optionality.adoc
b/antora/components/refguide-index/modules/applib/pages/index/annotation/Optionality.adoc
index 1ec5d5c0cf9..eb284915b95 100644
---
a/antora/components/refguide-index/modules/applib/pages/index/annotation/Optionality.adoc
+++
b/antora/components/refguide-index/modules/applib/pages/index/annotation/Optionality.adoc
@@ -55,9 +55,9 @@ Indicates that the property or parameter is not required.
[#MANDATORY]
=== MANDATORY
-Indicates that the property is required (even if the JDO
`javax.jdo.annotations.Column` annotation says otherwise).
+Indicates that the property is required (even if the JPA
`jakarta.persistenc.Column` annotation says otherwise).
-When using the JDO/DataNucleus objectstore, it is sometimes necessary to
annotate a property as optional (using
`javax.jdo.annotations.Column#allowsNull()` set to `true` ), even if the
property is logically mandatory. For example, this can occur when the property
is in a subtype class that has been "rolled up" to the superclass table using
`javax.jdo.annotations.Inheritance` > with the
`javax.jdo.annotations.InheritanceStrategy#SUPERCLASS_TABLE` superclass
strategy.
+When using xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] objectstore, it is
sometimes necessary to annotate a property as optional (using
jakarta.persistence.Column#nullable` set to `true` ), even if the property is
logically mandatory. For example, this can occur when the property is in a
subtype class that has been "rolled up" to the superclass table using
`jakarta.persistence.Inheritance` > with the
`jakarta.persistence.InheritanceType#SINGLE_TABLE` mapping strategy.
This annotation, therefore, is intended to override any objectstore-specific
annotation, so that Causeway can apply the constraint even though the
objectstore is unable to do so.
diff --git
a/antora/components/refguide-index/modules/applib/pages/index/mixins/updates/hooks/WithUpdatedAt_usage-notes.adoc
b/antora/components/refguide-index/modules/applib/pages/index/mixins/updates/hooks/WithUpdatedAt_usage-notes.adoc
index bb8b1395816..fa5b7866908 100644
---
a/antora/components/refguide-index/modules/applib/pages/index/mixins/updates/hooks/WithUpdatedAt_usage-notes.adoc
+++
b/antora/components/refguide-index/modules/applib/pages/index/mixins/updates/hooks/WithUpdatedAt_usage-notes.adoc
@@ -7,24 +7,30 @@
== Alternative approaches
-An alternative way to maintain a timestamp is to use JDO's `@Version`
annotation.
-With this approach, it is the JDO/DataNucleus that maintains the version,
rather than the framework's `TimestampService`.
+An alternative to using the framework's `TimestampService` is to leverage
xref:pjpa:ROOT:about.adoc[JPA/Eclipselink]’s built-in versioning support via
the `@jakarta.persistence.Version` annotation.
For example:
[source,java]
----
[email protected](
- strategy=VersionStrategy.DATE_TIME,
- column="version")
+import jakarta.persistence.Column;
+import jakarta.persistence.Entity;
+import jakarta.persistence.Version;
+
+@Entity
public class Customer {
- ...
+
+ @Version
+ @Column(name = "version")
+ private java.sql.Timestamp version;
+
public java.sql.Timestamp getVersionSequence() {
- return (java.sql.Timestamp) JDOHelper.getVersion(this);
+ return version;
}
}
----
+
== See also
* xref:refguide:applib:index/services/clock/ClockService.adoc[ClockService]
@@ -32,6 +38,5 @@ public class Customer {
used to obtain the current time.
* xref:refguide:applib:index/mixins/updates/OnUpdatedBy.adoc[OnUpdatedBy]
-
*
xref:refguide:applib:index/mixins/updates/OnUpdatedByAndAt.adoc[OnUpdatedByAndAt]
diff --git
a/antora/components/refguide-index/modules/applib/pages/index/services/repository/hooks/RepositoryService_020-examples-and-usage.adoc
b/antora/components/refguide-index/modules/applib/pages/index/services/repository/hooks/RepositoryService_020-examples-and-usage.adoc
index 064852a73f4..936b3b54449 100644
---
a/antora/components/refguide-index/modules/applib/pages/index/services/repository/hooks/RepositoryService_020-examples-and-usage.adoc
+++
b/antora/components/refguide-index/modules/applib/pages/index/services/repository/hooks/RepositoryService_020-examples-and-usage.adoc
@@ -161,13 +161,9 @@ public class ToDoItemRepositoryImplUsingJdoql implements
ToDoItemRepositoryImpl
[TIP]
====
-If using JPA, it is also possible to use the Spring Data repositories, using
xref:refguide:persistence:index/jpa/applib/services/JpaSupportService.adoc[JpaSupportService].
+It is also possible to use the Spring Data repositories, using
xref:refguide:persistence:index/jpa/applib/services/JpaSupportService.adoc[JpaSupportService].
====
-[TIP]
-====
-If using JDO/DataNucleus, it is also possible to use the DataNucleus type-safe
query API, see
xref:refguide:persistence:index/jdo/applib/services/JdoSupportService.adoc[JdoSupportService].
-====
diff --git
a/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M4/relnotes.adoc
b/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M4/relnotes.adoc
index ecbe3931d1e..7e06b86c699 100644
--- a/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M4/relnotes.adoc
+++ b/antora/components/relnotes/modules/ROOT/pages/2020/2.0.0-M4/relnotes.adoc
@@ -20,7 +20,7 @@ This includes new extension modules to persist commands
(xref:userguide:commandl
Also in this release, the _Kroviz client_ has been brought into the incubator.
This is a single-page app that runs within the browser to provide a UI similar
to that of the xref:vw:ROOT:about.adoc[Web UI (Wicket viewer)], but interacting
with the domain application exclusively through the REST API provided by the
xref:vro:ROOT:about.adoc[REST API (Restful Objects viewer)].
-The release also includes some preliminary work preparing the way for support
for JPA (as an alternative to xref:pjdo:ROOT:about.adoc[JDO/DataNucleus].
+The release also includes some preliminary work preparing the way for support
for JPA (as an alternative to JDO/DataNucleus).
This support is expected to be in the next milestone release.
Other work done in this release includes an experimental porting of the build
system from Maven to gradle (though Maven is for now still the official build
system of the framework).
diff --git a/antora/components/userguide/modules/ROOT/pages/overview.adoc
b/antora/components/userguide/modules/ROOT/pages/overview.adoc
index 38dd35bef1b..e45d5b4173f 100644
--- a/antora/components/userguide/modules/ROOT/pages/overview.adoc
+++ b/antora/components/userguide/modules/ROOT/pages/overview.adoc
@@ -30,7 +30,7 @@ Apache Causeway defines its own set of annotations, and
you can generally recognize an Apache Causeway domain class because it will be
probably be annotated using
xref:refguide:applib:index/annotation/DomainObject.adoc[@DomainObject] and
xref:refguide:applib:index/annotation/DomainService.adoc[@DomainService].
There are though configuration options that allow you to control to what
extent (some) annotations can be inferred implicitly rather than specified
explicitly.
-The framework also recognises some annotations from the ORM layer (ie
xref:pjpa::about.adoc[JPA/EclipseLink] or
xref:pjdo::about.adoc[JDO/DataNucleus]) and infers domain semantics from these
annotations.
+The framework also recognises some annotations from the ORM layer (ie
xref:pjpa::about.adoc[JPA/EclipseLink]) and infers domain semantics from these
annotations.
Similarly, JAXB annotations are often used for xref:view-models.adoc[view
models].
The framework also defines supplementary annotations, notably
xref:refguide:applib:index/annotation/DomainObjectLayout.adoc[@DomainObjectLayout]
and
xref:refguide:applib:index/annotation/DomainServiceLayout.adoc[@DomainServiceLayout].
diff --git a/antora/components/userguide/modules/ROOT/pages/value-types.adoc
b/antora/components/userguide/modules/ROOT/pages/value-types.adoc
index a08e3ddf90b..0f617d17ddf 100644
--- a/antora/components/userguide/modules/ROOT/pages/value-types.adoc
+++ b/antora/components/userguide/modules/ROOT/pages/value-types.adoc
@@ -596,10 +596,8 @@ Compared to scalar types, note that the
`ValueSemanticsProvider` does not need t
Also, it is not possible to use a custom value type as part of the object's
id, and so no implementation of `getIdStringifier()` is required either.
-If using within the database then you will also need to map the custom type to
the database:
-
-* if mapping to xref:pjpa::about.adoc[JPA/EclipseLink], use `@Embedded` and
`@Embeddable`; see for example
link:https://www.baeldung.com/jpa-embedded-embeddable[this baeldung post] on
the topic.
-* If mapping to xref:pjdo::about.adoc[JDO/DataNucleus], use `@Embedded` and
`@PersistenceCapable(embeddedOnly="true")`; see
https://www.datanucleus.org/products/accessplatform_6_0/jdo/mapping.html#embedded[Datanucleus
documentation].
+If using within the database then you will also need to map the custom type to
the database.
+If mapping to xref:pjpa::about.adoc[JPA/EclipseLink], use `@Embedded` and
`@Embeddable`; see for example
link:https://www.baeldung.com/jpa-embedded-embeddable[this baeldung post] on
the topic.
diff --git
a/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc
b/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc
index 81855d16328..c768b6b3e92 100644
---
a/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc
+++
b/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc
@@ -7,9 +7,8 @@
Domain entities are persistent domain objects, and will typically be annotated
with
xref:refguide:applib:index/annotation/DomainObject.adoc[@DomainObject(nature=ENTITY)].
-Their persistence is handled by either
xref:pjpa:ROOT:about.adoc[JPA/EclipseLink] or
xref:pjdo:ROOT:about.adoc[JDO/DataNucleus] ORM, with the ORM taking care of
both lazy loading and also the persisting of modified ("dirty") objects.
+Their persistence is handled by the xref:pjpa:ROOT:about.adoc[JPA/EclipseLink]
ORM, taking care of both lazy loading and also the persisting of modified
("dirty") objects.
-As such, they will also require ORM metadata.
-Both ORMs allow the metadata to be specified using either annotations or XML.
-The following sections show the basics for both ORMs, but see their respective
guides for more detail.
+As such, they will also require ORM metadata, specified using either
annotations or XML.
+The following sections show the basics.
diff --git
a/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/properties.adoc
b/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/properties.adoc
index 642396921e2..c4ddcc0eb8e 100644
---
a/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/properties.adoc
+++
b/antora/components/userguide/modules/ROOT/partials/properties-collections-actions/properties.adoc
@@ -20,7 +20,7 @@ It also provides a
xref:refguide:applib:index/annotation/PropertyLayout.adoc[@Pr
* the properties of domain entities are usually also annotated with ORM
annotation(s).
+
-For xref:pjpa::about.adoc[JPA/EclipseLink] this would be
link:https://www.objectdb.com/api/java/jpa/Column[javax.persistence.Column],
for xref:pjdo:ROOT:about.adoc[JDO/DataNucleus] it is
link:http://www.datanucleus.org/products/datanucleus/jdo/annotations.html#Column[@javax.jdo.annotations.Column]
annotation.
+For xref:pjpa::about.adoc[JPA/EclipseLink] this would be the
`jakarta.persistence.Column` annotation.
For property references, there may be other annotations to indicate whether
the reference is bidirectional.
It's also possible (using annotations) to define a link table to hold foreign
key columns.
@@ -76,22 +76,18 @@ private Customer customer;
It's ok for a xref:userguide:ROOT:view-models.adoc[view model] to reference
other view models and also to reference domain entities.
However, it _isn't_ valid for a domain entity to hold a reference to view
model, because the ORM will not know how to persist the view model object.
-[TIP]
-====
-For further details on mapping associations using
xref:pjdo:ROOT:about.adoc[JDO/DataNucleus], see their
link:http://www.datanucleus.org:15080/products/accessplatform_5_2/jdo/mapping.html[mapping
guide].
-====
[#optional-properties]
== Optional Properties
-(For domain entities) JDO/DataNucleus' default is that a property is assumed
to be mandatory if it is a primitive type (eg `int`, `boolean`), but optional
if a reference type (eg `String`, `BigDecimal` etc).
-To override optionality in JDO/DataNucleus the `@Column(allowsNull="...")`
annotations is used.
+(For domain entities) xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] default is
that a property is assumed to be optional, regardless of whether it is a
primitive type (eg `int`, `boolean`),or a reference type (eg `String`,
`BigDecimal` etc).
+To override optionality, use the `@Basic(optional="...")` annotation.
Apache Causeway on the other hand assumes that all properties (and action
parameters, for that matter) are mandatory, not optional.
These defaults can also be overridden using Apache Causeway' own annotations,
specifically `@Property(optionality=...)`, or (because it's much less verbose)
using `@javax.annotation.Nullable`.
These different defaults can lead to incompatibilities between the two
frameworks.
-To counteract that, Apache Causeway also recognizes and honours JDO's
`@Column(allowsNull=...)`.
+To counteract that, Apache Causeway also recognizes and honours JPA's
`@Column(nullable=...)`.
For example, you can write:
@@ -155,19 +151,19 @@ And, finally, if there is no configuration property set
at all, then the default
For entities, editable properties are not necessarily persistable.
In such a case the setter would not write to a field, but would (presumably)
mutate the object in some other way.
In such a case you will need a getter and a setter, but the property annotated
for the ORM as non-persistent.
-(If using JDO/DataNucleus, this is done using `@NotPersistent`).
+(If using xref:pjpa:ROOT:about.adoc[JPA/Eclipselink], this is done using
`@jakarta.persistence.Transient`).
For example:
[source,java]
----
import javax.inject.Inject;
-import javax.jdo.annotations.Column
-import javax.jdo.annotations.NotPersistent;
+import jakarta.persistence.Column;
+import jakarta.persistence.Transient;
import lombok.Getter;
import lombok.Setter;
[email protected]
+@Transient
@Property(editing=Editing.ENABLED)
public String getAddress() {
return addressService.toAddress( getLatLong() ); // <.>
@@ -184,7 +180,7 @@ private String latLong;
// <.>
@Inject
AddressService addressService; // <.>
----
-<.> the representation of the address, in human readable form, eg "10 Downing
Street, London, UK"
+<.> the representation of the address, in human-readable form, eg "10 Downing
Street, London, UK"
<.> the lat/long representation of the address, eg "51.503363;-0.127625".
Excluded from the Apache Causeway metamodel.
<.> an injected service that can convert to/from address and latLong.
@@ -194,7 +190,7 @@ Excluded from the Apache Causeway metamodel.
By default Apache Causeway will automatically render all properties in the
xref:vw:ROOT:about.adoc[Wicket UI] or in the xref:vro:ROOT:about.adoc[REST API].
To get Apache Causeway to ignore a property (exclude it from its metamodel),
annotate the getter using
xref:refguide:applib:index/annotation/Programmatic.adoc[@Programmatic].
-Similarly, for the JDO/DataNucleus ORM, ignore a property using the
`@javax.jdo.annotations.NotPersistent` annotation.
+Similarly, for the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] ORM, ignore a
property using the `@jakarta.persistence.Transient` annotation.
This is independent of Apache Causeway; in other words that property will
still be rendered in the UI (unless also annotated with `@Programmatic`).
For view models, you can tell JAXB to ignore a property using the
`@javax.xml.bind.annotation.XmlTransient` annotation.
@@ -215,18 +211,18 @@ For entities these may or may not be persisted; that
depends on whether the ORM
This section shows specific considerations for various datatypes, in
particular how to annotate them for the ORM.
-This section covers the xref:pjdo:ROOT:about.adoc[JDO/DataNucleus] object
store.
+This section covers the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] object
store.
=== ``String``s (Length)
-By default JDO/DataNucleus will map string properties to a `VARCHAR(255)`.
-To limit the length, use the `@Column(length=...)` annotation.
+By default xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] will map string
properties to a `VARCHAR(255)`.
+To limit the length, use the `@jakarta.persistence.Column(length=...)`
annotation.
For example:
[source,java]
----
-import javax.jdo.annotations.Column;
+import jakarta.persistence.Column;
import lombok.Getter;
import lombok.Setter;
@@ -236,32 +232,8 @@ import lombok.Setter;
private String firstName
----
-This is a good example of a case where Apache Causeway infers domain semantics
from the JDO annotation.
-
-=== JODA Dates
-
-Apache Causeway' bundles DataNucleus'
http://www.datanucleus.org/documentation/products/plugins.html[built-in
support] for Joda `LocalDate` and `LocalDateTime` datatypes, meaning that
entity properties of these types will be persisted as appropriate data types in
the database tables.
-
-It is, however, necessary to annotate your properties with
`@javax.jdo.annotations.Persistent`, otherwise the data won't actually be
persisted.
-See the link:http://db.apache.org/jdo/field_types.html[JDO docs] for more
details on this.
-
-Moreover, these datatypes are _not_ in the default fetch group, meaning that
JDO/DataNucleus will perform an additional `SELECT` query for each attribute.
-To avoid this extra query, the annotation should indicate that the property is
in the default fetch group.
+This is a good example of a case where Apache Causeway infers domain semantics
from the JPA annotation.
-For example:
-
-[source,java]
-----
-import javax.jdo.annotations.Persistent;
-import javax.jdo.annotations.Column;
-import org.joda.time.LocalDate;
-
-@Persistent(defaultFetchGroup="true")
-@Column(allowsNull="true")
-@Property
-@Getter @Setter
-private LocalDate dueBy;
-----
=== ``BigDecimal``s (Precision)
@@ -280,28 +252,17 @@ private BigDecimal impact;
----
Without any constraints, the length of the corresponding column is database
specific.
-For example, with HSQL JDO/DataNucleus maps to a column NUMERIC(19);
-no decimal digits are admitted.
-(Further details
http://hsqldb.org/doc/2.0/guide/sqlgeneral-chapt.html#sgc_numeric_types[here]).
+For example, with H2 xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] maps to a
column NUMERIC(19,2).
-What this implies is that, when a record is inserted, a log entry similar to
this one appears:
+Best practice is to explicitly specify the `scale` to the field like this, and
probably `precision` also:
[source,java]
----
-INSERT INTO ENTITY(..., IMPACT, ....) VALUES (...., 0.5, ....)
-----
-
-But when that same record is retrieved, the log will show that a value of "0"
is returned, instead of 0.5.
-
-The solution is to explicitly add the scale to the field like this:
-
-[source,java]
-----
-import javax.jdo.annotations.Column;
+import jakarta.persistence.Column;
import lombok.Getter;
import lombok.Setter;
-@Column(scale=2)
+@Column(precision=10, scale=2)
@Getter @Setter
private BigDecimal impact;
----
@@ -312,127 +273,54 @@ More information can be found
http://www.opentaps.org/docs/index.php/How_to_Use_
=== ``Blob``s
-Apache Causeway configures JDO/DataNucleus so that the properties of type
`org.apache.causeway.applib.value.Blob` and
`org.apache.causeway.applib.value.Clob` can also be persisted.
+Apache Causeway provides the
xref:refguide:persistence:index/jpa/applib/types/BlobJpaEmbeddable.adoc[]
utility class to allow properties of type
`org.apache.causeway.applib.value.Blob` to be persisted.
-As for Joda dates, this requires the `@javax.jdo.annotations.Persistent`
annotation.
-However, whereas for dates one would always expect this value to be retrieved
eagerly, for blobs and clobs it is not so clear cut.
-
-For example:
+This is used as follows:
[source,java]
----
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Persistent;
-import lombok.Getter;
-import lombok.Setter;
-
-@Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "attachment_name"),
- @Column(name = "attachment_mimetype"),
- @Column(name = "attachment_bytes",
- jdbcType="BLOB", sqlType = "LONGVARBINARY")
+@AttributeOverrides({
+ @AttributeOverride(name="name", column=@Column(name="attachment_name")),
+
@AttributeOverride(name="mimeType",column=@Column(name="attachment_mimeType")),
+ @AttributeOverride(name="bytes", column=@Column(name="attachment_bytes"))
})
-@Property(optionality = Optionality.OPTIONAL)
-@Getter @Setter
-private Blob attachment;
-----
-
-The three `@Column` annotations are required because the mapping classes that
Apache Causeway provides
(https://github.com/apache/causeway/blob/causeway-1.4.0/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/causeway/objectstore/jdo/datanucleus/valuetypes/CausewayBlobMapping.java#L59[CausewayBlobMapping]
and
https://github.com/apache/causeway/blob/causeway-1.4.0/component/objectstore/jdo/jdo-datanucleus/src/main/java/org/apache/causeway/objectstore/jdo/datanucleus/value
[...]
-(It is not an error to omit these `@Column` annotations, but without them the
names of the table columns are simply suffixed `_0`, `_1`, `_2` etc.
+@Embedded
+private BlobJpaEmbeddable attachment;
-If the `Blob` is mandatory, then use:
-
-[source,java]
-----
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Persistent;
-import lombok.Getter;
-import lombok.Setter;
-
-@Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "attachment_name", allowsNull="false"),
- @Column(name = "attachment_mimetype", allowsNull="false"),
- @Column(name = "attachment_bytes",
- jdbcType="BLOB", sqlType = "LONGVARBINARY", allowsNull="false")
-})
-@Property(optionality = Optionality.MANDATORY )
-@Getter @Setter
-private Blob attachment;
+@Property()
+@PropertyLayout()
+public Blob getPdf() {
+ return BlobJpaEmbeddable.toBlob(pdf);
+}
+public void setPdf(final Blob pdf) {
+ this.pdf = BlobJpaEmbeddable.fromBlob(pdf);
+}
----
-[NOTE]
-====
-If specifying a `sqlType` of "LONGVARBINARY" does not work, try instead "BLOB".
-There can be differences in behaviour between JDBC drivers.
-====
-
=== ``Clob``s
-Mapping ``Clob``s works in a very similar way to ``Blob``s, but the `jdbcType`
and `sqlType` attributes will, respectively, be `CLOB` and `LONGVARCHAR`:
+Mapping ``Clob``s works in a very similar way to ``Blob``s, using the
xref:refguide:persistence:index/jpa/applib/types/ClobJpaEmbeddable.adoc[]
utility class:
[source,java]
----
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Persistent;
-import lombok.Getter;
-import lombok.Setter;
-
-@Persistent(defaultFetchGroup="false", columns = {
- @Column(name = "attachment_name"),
- @Column(name = "attachment_mimetype"),
- @Column(name = "attachment_chars",
- jdbcType="CLOB", sqlType = "LONGVARCHAR")
+@AttributeOverrides({
+ @AttributeOverride(name="name", column=@Column(name="doc_name")),
+ @AttributeOverride(name="mimeType",column=@Column(name="doc_mimeType")),
+ @AttributeOverride(name="bytes", column=@Column(name="doc_bytes"))
})
-@Property( optionality = Optionality.OPTIONAL )
-@Getter @Setter
-private Clob doc;
-----
-
-[NOTE]
-====
-If specifying a `sqlType` of "LONGVARCHAR" does not work, try instead "CLOB".
-There can be differences in behaviour between JDBC drivers.
-====
-
-=== Mapping to VARBINARY or VARCHAR
-
-Instead of mapping to a sqlType of `LONGVARBINARY` (or perhaps `BLOB`), you
might instead decide to map to a `VARBINARY`.
-The difference is whether the binary data is held "on-row" or as a pointer
"off-row"; with a `VARBINARY` the data is held on-row and so you will need to
specify a length.
-
-For example:
-
-[source,java]
-----
-import javax.jdo.annotations.Column;
-import lombok.Getter;
-import lombok.Setter;
-
-@Column(
- name = "attachment_bytes",
- jdbcTypr="BLOB", sqlType = "VARBINARY", length=2048
-)
@Getter @Setter
-private Blob image;
-----
-
-The same argument applies to `LONGVARCHAR` (or `CLOB`); you could instead map
to a regular `VARCHAR`:
-
-[source,java]
-----
-import javax.jdo.annotations.Column;
-import lombok.Getter;
-import lombok.Setter;
+private ClobJpaEmbeddable doc;
-@Column(
- name = "attachment_chars",
- sqlType = "VARCHAR", length=2048
-)
-@Getter @Setter
-private Clob letter;
+@Property()
+@PropertyLayout()
+public Clob getDoc() {
+ return ClobJpaEmbeddable.toClob(doc);
+}
+public void setDoc(final Clob doc) {
+ this.doc = ClobJpaEmbeddable.fromClob(doc);
+}
----
-Support and maximum allowed length will vary by database vendor.
-
diff --git a/starters/adoc/modules/starters/pages/simpleapp.adoc
b/starters/adoc/modules/starters/pages/simpleapp.adoc
index 76f78d4c317..b3743e98e5d 100644
--- a/starters/adoc/modules/starters/pages/simpleapp.adoc
+++ b/starters/adoc/modules/starters/pages/simpleapp.adoc
@@ -557,25 +557,23 @@ The `SimpleModuleIntegTestAbstract` is the superclass of
all integration tests i
.SimpleModuleIntegTestAbstract.java
----
@SpringBootTest(
- classes = SimpleModuleIntegTestAbstract.TestApp.class // <.>
+ classes = SimpleModuleIntegTestAbstract.TestApp.class //
<.>
)
@ActiveProfiles("test") // <.>
public abstract class SimpleModuleIntegTestAbstract
- extends CausewayIntegrationTestAbstractWithFixtures { // <.>
+ extends CausewayIntegrationTestAbstractWithFixtures { //
<.>
@Configuration
@Import({
- CausewayModuleCoreRuntimeServices.class, // <.>
- CausewayModuleSecurityBypass.class, // <.>
- CausewayModuleJdoDataNucleus5.class, // <.>
- CausewayModuleTestingFixturesApplib.class, // <.>
+ CausewayModuleCoreRuntimeServices.class, //
<.>
+ CausewayModuleSecurityBypass.class, //
<.>
+ CausewayModuleJpaEclipseLink.class, //
<.>
+ CausewayModuleTestingFixturesApplib.class, //
<.>
- SimpleModule.class // <.>
+ SimpleModule.class //
<.>
})
@PropertySources({
- @PropertySource(CausewayPresets.H2InMemory_withUniqueSchema),
// <.>
- @PropertySource(CausewayPresets.DatanucleusAutocreateNoValidate),
// <.>
- @PropertySource(CausewayPresets.UseLog4j2Test),
// <.>
+ @PropertySource(CausewayPresets.H2InMemory_withUniqueSchema), //
<.>
})
public static class TestApp {
}
@@ -590,14 +588,12 @@ public abstract class SimpleModuleIntegTestAbstract
In this case, the test inherits from the
`CausewayIntegrationTestAbstractWithFixtures` subclass which also adds in
support for running fixtures.
<.> Specifies the modules that make up Apache Causeway framework itself.
-These include core, security set to the bypass implementation (effectively is
ignored) and JDO/DataNucleus for persistence.
+These include core, security set to the bypass implementation (effectively is
ignored) and xref:pjpa:ROOT:about.adoc[JPA/Eclipselink] for persistence.
Note that no viewers are bootstrapped because the tests are run through
Spring's integration testing framework, rather than (say) as Selenium tests.
<.> Disables security checks.
-<.> Configures JDO as the ORM.
-+
-If using JPA, this would be `CausewayModuleJpaEclipseLink.class` instead.
+<.> Configures JPA as the ORM.
<.> Brings in support for running fixtures.
+
@@ -608,11 +604,6 @@ You can learn more about testing in the
xref:testing:ROOT:about.adoc[Testing Gui
<.> Runs the tests in memory using H2.
A unique schema allows tests to potentially be run in parallel
-<.> Ensures that JDO/DataNucleus is configured to create the database schema
first.
-This may be required because the application might otherwise be configured to
use the xref:userguide:flyway:about.adoc[Flyway integration].
-
-<.> Sets up logging to use the configuration defined in the `log4j2-test.xml`
file
-
=== webapp's src/main/java
diff --git
a/testing/integtestsupport/adoc/modules/integtestsupport/pages/hints-and-tips.adoc
b/testing/integtestsupport/adoc/modules/integtestsupport/pages/hints-and-tips.adoc
index 56b4b4087bd..1fe8e16d37e 100644
---
a/testing/integtestsupport/adoc/modules/integtestsupport/pages/hints-and-tips.adoc
+++
b/testing/integtestsupport/adoc/modules/integtestsupport/pages/hints-and-tips.adoc
@@ -2,10 +2,3 @@
:Notice: 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. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by
applicable law or ag [...]
-== If using JDO/DataNucleus
-
-When running integration tests through the IDE, and if using the
JDO/DataNucleus ORM, then make sure the module(s) with entities have been
enhanced first.
-
-If using IntelliJ, we recommend creating a run Maven configuration that runs
`datanucleus:enhance`, and then pinning the configuration once run as a tab in
the "Debug" window for easy access.
-
-image::pin-enhance-run-configuration.png[width="400px"]