You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@causeway.apache.org by da...@apache.org on 2023/06/18 17:13:03 UTC

[causeway] 10/12: CAUSEWAY-3395: reworking user guide

This is an automated email from the ASF dual-hosted git repository.

danhaywood pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/causeway.git

commit 7de7d74e17b99c40cb8208eb5d925953adac0dbe
Author: danhaywood <da...@haywood-associates.co.uk>
AuthorDate: Sun Jun 18 17:35:21 2023 +0100

    CAUSEWAY-3395: reworking user guide
---
 .../userguide/modules/ROOT/pages/about.adoc        |   4 +-
 .../modules/ROOT/pages/domain-entities.adoc        | 228 +------------
 .../modules/ROOT/pages/domain-services.adoc        |   2 +-
 .../ROOT/partials/domain-entities/_intro.adoc      |  28 ++
 .../ROOT/partials/domain-entities/progmodel.adoc   | 352 +++++++++++++++++++++
 .../{introduction.adoc => _intro.adoc}             |   0
 .../domain-services/progmodel.adoc}                |  10 +-
 .../drop-down-and-defaults/_intro.adoc}            |  10 +-
 .../drop-down-and-defaults/progmodel.adoc}         |  10 +-
 .../events/_intro.adoc}                            |  10 +-
 .../events/progmodel.adoc}                         |  10 +-
 .../meta-annotations/_intro.adoc}                  |  10 +-
 .../meta-annotations/progmodel.adoc}               |  10 +-
 .../mixins/_intro.adoc}                            |  10 +-
 .../mixins/progmodel.adoc}                         |  10 +-
 .../modules/_intro.adoc}                           |  10 +-
 .../modules/progmodel.adoc}                        |  10 +-
 .../object-members/progmodel.adoc}                 |  10 +-
 .../ui/_intro.adoc}                                |  10 +-
 .../ui/progmodel.adoc}                             |  10 +-
 .../value-types/_intro.adoc}                       |  10 +-
 .../value-types/progmodel.adoc}                    |  10 +-
 .../view-models/_intro.adoc}                       |  10 +-
 .../view-models/progmodel.adoc}                    |  10 +-
 .../modules/btb/pages/programming-model.adoc       |   5 +-
 .../partials/programming-model/_intro.adoc}        |   5 +-
 26 files changed, 443 insertions(+), 361 deletions(-)

diff --git a/antora/components/userguide/modules/ROOT/pages/about.adoc b/antora/components/userguide/modules/ROOT/pages/about.adoc
index e2895827b6..d4622b1bea 100644
--- a/antora/components/userguide/modules/ROOT/pages/about.adoc
+++ b/antora/components/userguide/modules/ROOT/pages/about.adoc
@@ -9,7 +9,7 @@ This user guide aims to get you developing Causeway applications as quickly as p
 [TIP]
 .Quick start resources
 ====
-If you prefer to "do" rather to than "read", use the xref:docs:starters:helloworld.adoc[] and xref:docs:starters:simpleapp.adoc[] starter apps to get going.
+If you prefer learn by _doing_, you can use the xref:docs:starters:helloworld.adoc[] and xref:docs:starters:simpleapp.adoc[] starter apps to get going in a few minutes.
 Also check out the xref:docs:demo:about.adoc[] which provides a working example of much of the Causeway programming model; you can access a live instance link:https://demo-wicket-jpa-snapshot.apps.causeway.dev/[here].
 ====
 
@@ -19,7 +19,7 @@ The following pages then look at each of those building blocks in a little more
 * xref:userguide:ROOT:domain-entities.adoc[Domain Entities]
 +
 Domain entities hold persisted state of domain objects such as `Customer` or `Order`.
-They can and often do also include business logic, encapsulating the state.
+They can and often do also include business logic, encapsulating the manipulations of their state.
 
 * xref:userguide:ROOT:domain-services.adoc[Domain Services]
 +
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-entities.adoc b/antora/components/userguide/modules/ROOT/pages/domain-entities.adoc
index aac43c3c61..dbd99a00b6 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-entities.adoc
+++ b/antora/components/userguide/modules/ROOT/pages/domain-entities.adoc
@@ -3,232 +3,8 @@
 :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 [...]
 
 
-== Introduction
-
-Most domain objects that the end-user interacts with are likely to be _domain entities_, such as `Customer`, `Order`, `Product` and so on.
-These are persistent objects and which are mapped to a relational database using either xref:pjpa::about.adoc[JPA/EclipseLink] or xref:pjdo::about.adoc[JDO/DataNucleus] ORM.
-
-Some domain entities are really aggregates, a combination of multiple objects.
-A commonly cited example of this is an `Order`, which really consists of both a root `Order` entity and a collection of ``OrderItem``s.
-From the end-users' perspective, when they talk of "order" they almost always mean the aggregate rather than just the `Order` root entity.
-
-Eric Evans' link:http://books.google.com/books/about/Domain_Driven_Design.html?id=hHBf4YxMnWMC[Domain Driven Design] has a lot to say about aggregate roots and their responsibilities: in particular that it is the responsibility of the aggregate root to maintain the invariants of its component pieces, and that roots may only reference other roots.
-There's good logic here: requiring only root-to-root relationships reduces the number of moving parts that the developer has to think about.
-
-On the other hand, this constraint can substantially complicate matters when mapping domain layer to the persistence layer.
-DDD tends to de-emphasise such matters: it aims to be completely agnostic about the persistence layer, with the responsibilities for managing relationships moved (pretty much by definition) into the domain layer.
-
-As a framework Apache Causeway is less dogmatic about such things.
-Generally the domain objects are mapped to a relational database and so we can lean on the referential integrity capabilities of the persistence layer to maintain referential invariants.
-Said another way: we don't tend to require that only roots can maintain roots: we don't see anything wrong in an `InvoiceItem` referencing an `OrderItem`, for example.
-
-Nonetheless the concepts of "aggregate" and "aggregate root" are worth holding onto.
-You'll probably find yourself defining a repository service (discussed in more detail below) for each aggregate root: for example `Order` will have a corresponding `OrderRepository` service.
-Similarly, you may also have a factory service, for example `OrderFactory`.
-However, you are less likely to have a repository service for the parts of an aggregate root: the role of retrieving ``OrderItem``s should fall to the `Order` root (typically by way of lazy loading of an "items" collection) rather than through an `OrderItemRepository` service.
-This isn't a hard-n-fast rule, but it is a good rule of thumb.
-
-
-
-== Practically Speaking
-
-Domain entities are persistent domain objects, with their persistence handled an ORM (such as xref:pjdo:ROOT:about.adoc[JDO/DataNucleus]).
-As such, they are mapped to a persistent object store, typically an RDBMS, with the ORM taking care of both lazy loading and also the persisting of modified ("dirty") objects.
-
-The vast majority of such entities will be annotated with `@DomainObject(nature=ENTITY)`.
-In addition they will also require ORM metadata.
-
-* for xref:pjpa:ROOT:about.adoc[JPA/Eclipselink], this requires the `javax.persistence.Entity` annotation
-* for xref:pjdo:ROOT:about.adoc[JDO/DataNucleus], this requires the
-`@javax.jdo.annotations.PersistenceCapable` annotation.
-
-TIP: It is also possible to specify ORM metadata using `.xml` files.
-
-In this section we discuss the mechanics of writing domain objects that comply with Apache Causeway' programming model.
-
-
-== Entities (JPA)
-
-JPA entities are typically defined using the `@javax.persistence.Entity` annotation, with additional annotations to define their primary key, scalar properties and relationships to other entities.
-
-For some examples, see:
-
-* https://www.baeldung.com/jpa-entities[Baeldung article on JPA entities]
-* https://spring.io/guides/gs/accessing-data-jpa/[Spring Data tutorial]
-* https://docs.jboss.org/hibernate/annotations/3.5/reference/en/html/entity.html#entity-mapping[JBoss tutorial]
-
-See the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink object store] for further information on annotating domain entities.
-
-
-== Entities (JDO)
-
-See the xref:pjdo:ROOT:about.adoc[JDO/DataNucleus object store] for further information on annotating domain entities.
-
-[#persistencecapable]
-=== PersistenceCapable
-
-NOTE: This section is specific to the xref:pjdo:ROOT:about.adoc[JDO API]
-
-With the xref:pjdo:ROOT:about.adoc[JDO API], entities are flagged as being "persistence capable", indicating how the ORM should manage their identity:
-
-[source,java]
-----
-@javax.jdo.annotations.PersistenceCapable(                              // <.>
-        identityType=IdentityType.DATASTORE,                            // <.>
-        schema = "simple",                                              // <.>
-        table = "SimpleObject"
-)
-@javax.jdo.annotations.DatastoreIdentity(                               // <.>
-        strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
-        column="id"
-)
-@javax.jdo.annotations.Version(                                         // <.>
-        strategy= VersionStrategy.DATE_TIME,
-        column="version"
-)
-@DomainObject(                                                          // <.>
-        logicalTypeName = "simple.SimpleObject"
-)
-public class SimpleObject { /* ... */ }
-----
-<.> The `@PersistenceCapable` annotation indicates that this is an entity to DataNucleus.
-The DataNucleus enhancer acts on the bytecode of compiled entities, injecting lazy loading and dirty object tracking functionality.
-Enhanced entities end up also implementing the `javax.jdo.spi.PersistenceCapable` interface.
-
-<.> Indicates how identifiers for the entity are handled.
-Using `DATASTORE` means that a DataNucleus is responsible for assigning the value (rather than the application).
-
-<.> Specifies the RDBMS database schema and table name for this entity will reside.
-The schema should correspond with the module in which the entity resides.
-The table will default to the entity name if omitted.
-
-<.> For entities that are using `DATASTORE` identity, indicates how the id will be assigned.
-A common strategy is to allow the database to assign the id, for example using an identity column or a sequence.
-
-<.> The `@Version` annotation is useful for optimistic locking; the strategy indicates what to store in the `version` column.
-
-<.> The `@DomainObject` annotation identifies the domain object to Apache Causeway (not DataNucleus).
-It isn't necessary to include this annotation -- at least, not for entities -- but it is nevertheless recommended.
-In particular, its strongly recommended that the `logicalTypeName` (which acts like an alias to the concrete domain class) is specified; note that it corresponds to the schema/table for DataNucleus' `@PersistenceCapable` annotation.
-
-
-=== Key Properties (JDO)
-
-NOTE: This section is specific to the xref:pjdo:ROOT:about.adoc[JDO API]
-
-All domain entities will have some sort of mandatory key properties.
-The example below is a very simple case, where the entity is identified by a `name` property.
-This is often used in database unique indices, and in the `toString()` implementation:
-
-[source,java]
-----
-import javax.jdo.annotations.Column;
-import javax.jdo.annotations.Unique;
-import lombok.Getter;
-import lombok.Setter;
-import lombok.ToString;
-import lombok.ToString.Include;
-...
-@Unique(
-    name="SimpleObject_name_UNQ", members = {"name"})               // <.>
-@ToString(onlyExplicitlyIncluded = true)
-public class SimpleObject
-             implements Comparable<SimpleObject> {                  // <.>
-
-    public SimpleObject(String name) {
-        setName(name);
-    }
-
-    @Column(allowsNull="false", length=50)                          // <.>
-    @Getter @Setter                                                 // <.>
-    @ToString.Include                                               // <.>
-    private String name;
-
-    private final static Comparator<SimpleObject> comparator =
-            Comparator.comparing(SimpleObject::getName);
-
-    @Override
-    public int compareTo(final SimpleObject other) {
-        return comparator.compare(this, other);                     // <.>
-    }
-}
-----
-<.> DataNucleus will automatically add a unique index to the primary surrogate id (discussed above), but additional alternative keys can be defined using the `@Unique` annotation.
-In the example above, the "name" property is assumed to be unique.
-
-<.> Although not required, we strongly recommend that all entities are naturally `Comparable`.
-This then allows parent/child relationships to be defined using ``SortedSet``s; RDBMS after all are set-oriented.
-
-<.> Chances are that some of the properties of the entity will be mandatory, for example any properties that represent an alternate unique key to the entity.
-The `@Column` annotation specifies the length of the column in the RDBMS, and whether it is mandatory.
-+
-Given there is a unique index on `name`, we want this to be mandatory.
-+
-We can also represent this using a constructor that defines these mandatory properties.
-The ORM will create a no-arg constructor to allow domain entity to be rehydrated from the database at runtime (it then sets all state reflectively).
-
-<.> Use Lombok to generate the getters and setters for the `name` property itself.
-
-<.> Use Lombok to create a `toString()` implementation that includes the value of `name` property.
-
-<.> Use `java.util.Comparator#comparing()` to implement `Comparable` interface.
-
-
-=== Queries (JDO)
-
-NOTE: This section is specific to the xref:pjdo:ROOT:about.adoc[JDO API]
-
-When using JDO, it's also common for domain entities to have queries annotated on them.
-These are used by repository domain services to query for instances of the entity:
-
-[source,java]
-----
-...
-@javax.jdo.annotations.Queries({
-    @javax.jdo.annotations.Query(                                     // <.>
-      name = "findByName",                                            // <.>
-      value = "SELECT "                                               // <.>
-            + "FROM domainapp.modules.simple.dom.impl.SimpleObject "  // <.>
-            + "WHERE name.indexOf(:name) >= 0 ")                      // <.>
-})
-...
-public class SimpleObject { /* ... */ }
-----
-<.> There may be several `@Query` annotations, nested within a `@Queries` annotation) defines queries using JDOQL.
-
-<.> Defines the name of the query.
-
-<.> The definition of the query, using JDOQL syntax.
-
-<.> The fully-qualified class name. +
-Must correspond to the class on which the annotation is defined (the framework checks this automatically on bootstrapping).
-
-<5> In this particular query, is an implementation of a LIKE "name%" query.
-
-JDO/DataNucleus provides several APIs for defining queries, including entirely programmatic and type-safe APIs; but JDOQL is very similar to SQL and so easily learnt.
-
-To actually use the above definition, the framework provides the xref:refguide:applib:index/services/repository/RepositoryService.adoc[RepositoryService].
-This is a generic repository for any domain class.
-
-The corresponding repository method for the above query is:
-
-[source,java]
-----
-public List<SimpleObject> findByName(String name) {
-    return repositoryService.allMatches(            // <.>
-            Query.named(SimpleObject.class,         // <.>
-                        "findByName")               // <.>
-                   .withParameter("name", name)     // <.>
-            );
-}
-
-@javax.inject.Inject
-RepositoryService repositoryService;
-----
-<.> find all instances that match the query
-<.> Specifies the class that is annotated with `@Query`
-<.> Corresponds to the `@Query#name` attribute
-<.> Corresponds to the `:name` parameter in the query JDOQL string
+include::partial$domain-entities/_intro.adoc[leveloffset=+1]
+include::partial$domain-entities/progmodel.adoc[leveloffset=+1]
 
 
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
index d7848f03b8..00e0010c45 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
@@ -4,7 +4,7 @@
 
 
 
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
+include::partial$domain-services/_intro.adoc[leveloffset=+1]
 include::partial$domain-services/inject-services.adoc[leveloffset=+1]
 include::partial$domain-services/crud.adoc[leveloffset=+1]
 
diff --git a/antora/components/userguide/modules/ROOT/partials/domain-entities/_intro.adoc b/antora/components/userguide/modules/ROOT/partials/domain-entities/_intro.adoc
new file mode 100644
index 0000000000..908bd7f63b
--- /dev/null
+++ b/antora/components/userguide/modules/ROOT/partials/domain-entities/_intro.adoc
@@ -0,0 +1,28 @@
+[[introduction]]
+= Introduction
+
+: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 [...]
+:page-partial:
+
+Most domain objects that the end-user interacts with are likely to be _domain entities_, such as `Customer`, `Order`, `Product` and so on.
+These are persistent objects and which are mapped to a relational database using either xref:pjpa::about.adoc[JPA/EclipseLink] or xref:pjdo::about.adoc[JDO/DataNucleus] ORM.
+
+Some domain entities are really aggregates, a combination of multiple objects.
+A commonly cited example of this is an `Order`, which really consists of both a root `Order` entity and a collection of ``OrderItem``s.
+From the end-users' perspective, when they talk of "order" they almost always mean the aggregate rather than just the `Order` root entity.
+
+Eric Evans' link:http://books.google.com/books/about/Domain_Driven_Design.html?id=hHBf4YxMnWMC[Domain Driven Design] has a lot to say about aggregate roots and their responsibilities: in particular that it is the responsibility of the aggregate root to maintain the invariants of its component pieces, and that roots may only reference other roots.
+There's good logic here: requiring only root-to-root relationships reduces the number of moving parts that the developer has to think about.
+
+On the other hand, this constraint can substantially complicate matters when mapping domain layer to the persistence layer.
+DDD tends to de-emphasise such matters: it aims to be completely agnostic about the persistence layer, with the responsibilities for managing relationships moved (pretty much by definition) into the domain layer.
+
+As a framework Apache Causeway is less dogmatic about such things.
+Generally the domain objects are mapped to a relational database and so we can lean on the referential integrity capabilities of the persistence layer to maintain referential invariants.
+Said another way: we don't tend to require that only roots can maintain roots: we don't see anything wrong in an `InvoiceItem` referencing an `OrderItem`, for example.
+
+Nonetheless the concepts of "aggregate" and "aggregate root" are worth holding onto.
+You'll probably find yourself defining a repository service (discussed in more detail below) for each aggregate root: for example `Order` will have a corresponding `OrderRepository` service.
+Similarly, you may also have a factory service, for example `OrderFactory`.
+However, you are less likely to have a repository service for the parts of an aggregate root: the role of retrieving ``OrderItem``s should fall to the `Order` root (typically by way of lazy loading of an "items" collection) rather than through an `OrderItemRepository` service.
+This isn't a hard-n-fast rule, but it is a good rule of thumb.
diff --git a/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc b/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc
new file mode 100644
index 0000000000..9a901f83f9
--- /dev/null
+++ b/antora/components/userguide/modules/ROOT/partials/domain-entities/progmodel.adoc
@@ -0,0 +1,352 @@
+[[programming-model]]
+= Programming Model
+
+: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 [...]
+:page-partial:
+
+
+Domain entities are persistent domain objects, and will typically be annotated with `@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.
+
+As such, they will also require ORM metadata.
+Both ORMs allow the metadata to be specified using either annotations or XML.
+In this section we explain the basics, using annotations.
+
+
+== Entities (JPA)
+
+If the xref:pjpa:ROOT:about.adoc[JPA/EclipseLink] object store is to be used, then the domain entities should be annotated using JPA annotations.
+
+This section shows a simple example.
+See the xref:pjpa:ROOT:about.adoc[JPA/Eclipselink object store] documentation for further information on annotating domain entities.
+
+
+=== 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.
+
+
+[source,java]
+----
+@javax.persistence.Entity                                               // <.>
+@javax.persistence.Table(
+    schema= "simple"                                                    // <.>
+    // ...
+)
+@EntityListeners(CausewayEntityListener.class)                          // <.>
+@DomainObject(                                                          // <.>
+        logicalTypeName = "simple.SimpleObject"
+)
+public class SimpleObject {
+
+    @javax.persistence.Id                                               // <.>
+    @javax.persistence.GeneratedValue(strategy = GenerationType.AUTO)   // <3>
+    @javax.persistence.Column(name = "id", nullable = false)            // <.>
+    private Long id;
+
+    @javax.persistence.Version                                          // <.>
+    @javax.persistence.Column(name = "version", nullable = false)       // <5>
+    @PropertyLayout(fieldSetId = "metadata", sequence = "999")
+    @Getter @Setter
+    private long version;
+
+    //...
+}
+----
+
+<.> The `@Entity` annotation indicates that this is an entity to EclipseLink.
+<.> Specifies the RDBMS database schema for this entity.
+It's recommended that the schema corresponds to the module in which the entity resides.
+The table will default to the entity name if omitted.
+<.> Required boilerplate that allows Causeway to inject domain services into the entity when retrieved from the database
+<.> The `@DomainObject` annotation identifies the domain object to Apache Causeway (not EclipseLink).
+It isn't necessary to include this annotation -- at least, not for entities -- but it is nevertheless recommended.
+In particular, its strongly recommended that the `logicalTypeName` (which acts like an alias to the concrete domain class) is specified; note that it corresponds to the schema/table for EcilpseLink's `@Table` annotation.
+<.> Specified the primary key, indicating that the database will assign the key, for example using an identity column or a sequence.
+<.> Indicates the column name (though this would be inferred) and nullability (such a primary keys should not be nullable).
+<.> The `@Version` annotation is useful for optimistic locking; the strategy indicates what to store in the `version` column.
+
+
+=== Scalar Properties
+
+All domain entities will have some sort of mandatory key properties.
+Additional annotations are also required to define their scalar properties and relationships to other entities.
+
+The example below is a very simple case, where the entity is identified by a `name` property.
+This is often used in database unique indices, and in the `toString()` implementation:
+
+[source,java]
+----
+import javax.persistence.Column;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.ToString.Include;
+
+@javax.persistence.Table(
+    schema= SimpleModule.SCHEMA,
+    uniqueConstraints = {
+        @UniqueConstraint(name = "SimpleObject__name__UNQ",
+                          columnNames = {"name"})                   // <.>
+    }
+)
+public class SimpleObject
+             implements Comparable<SimpleObject> {                  // <.>
+
+    // ...
+    public SimpleObject(String name) {
+        setName(name);
+    }
+
+    @Column(allowsNull="false", length=50)                          // <.>
+    @Getter @Setter                                                 // <.>
+    @ToString.Include                                               // <.>
+    private String name;
+
+    private final static Comparator<SimpleObject> comparator =
+            Comparator.comparing(SimpleObject::getName);
+
+    @Override
+    public int compareTo(final SimpleObject other) {
+        return comparator.compare(this, other);                     // <.>
+    }
+}
+----
+<.> EclipseLink will automatically add a unique index to the primary surrogate id (discussed above), but additional alternative keys can be defined using the `@Unique` annotation.
+In the example above, the "name" property is assumed to be unique.
+<.> Although not required, we strongly recommend that all entities are naturally `Comparable`.
+This then allows parent/child relationships to be defined using ``SortedSet``s; RDBMS after all are set-oriented.
+<.> Chances are that some of the properties of the entity will be mandatory, for example any properties that represent an alternate unique key to the entity.
+The `@Column` annotation specifies the length of the column in the RDBMS, and whether it is mandatory.
++
+Given there is a unique index on `name`, we want this to be mandatory.
++
+We can also represent this using a constructor that defines these mandatory properties.
+The ORM will create a no-arg constructor to allow domain entity to be rehydrated from the database at runtime (it then sets all state reflectively).
+
+<.> Use Lombok to generate the getters and setters for the `name` property itself.
+<.> Use Lombok to create a `toString()` implementation that includes the value of `name` property.
+
+<.> Use `java.util.Comparator#comparing()` to implement `Comparable` interface.
+
+
+=== Queries
+
+When using JPA, it's also common for domain entities to have queries annotated on them.
+These are used by repository domain services to query for instances of the entity:
+
+[source,java]
+----
+...
+@javax.persistence.NamedQueries({
+        @javax.persistence.NamedQuery(                                  // <.>
+                name = "findByNameLike",                                // <.>
+                query = "SELECT so " +                                  // <.>
+                        "FROM SimpleObject so " +
+                        "WHERE so.name LIKE :name"
+        )
+})
+
+@javax.jdo.annotations.Queries({
+    @javax.jdo.annotations.Query(                                     // <.>
+      name = "findByName",                                            // <.>
+      value = "SELECT "                                               // <.>
+            + "FROM domainapp.modules.simple.dom.impl.SimpleObject "  // <.>
+            + "WHERE name.indexOf(:name) >= 0 ")                      // <.>
+})
+...
+public class SimpleObject { /* ... */ }
+----
+<.> There may be several `@NamedQuery` annotations, nested within a `@NamedQueries` annotation) defines queries using JPAQL.
+<.> Defines the name of the query.
+<.> The definition of the query, using JPAQL syntax.
+
+To actually use the above definition, the framework provides the xref:refguide:applib:index/services/repository/RepositoryService.adoc[RepositoryService].
+This is a generic repository for any domain class.
+
+The corresponding repository method for the above query is:
+
+[source,java]
+----
+public List<SimpleObject> findByName(String name) {
+    return repositoryService.allMatches(            // <.>
+            Query.named(SimpleObject.class,         // <.>
+                        "findByNameLike")           // <.>
+                   .withParameter("name", name)     // <.>
+            );
+}
+
+@Inject RepositoryService repositoryService;
+----
+<.> find all instances that match the query
+<.> Specifies the class that is annotated with `@NamedQuery`
+<.> Corresponds to the `@NamedQuery#name` attribute
+<.> Corresponds to the `:name` parameter in the query JDOQL string
+
+
+
+
+== Entities (JDO)
+
+If the xref:pjdo:ROOT:about.adoc[JDO/DataNucleus object store] is to be used, then the domain entities should be annotated using JDO annotations.
+
+This section shows a simple example.
+See the xref:pjdo:ROOT:about.adoc[JDO/DataNucleus object store] documentation for further information on annotating domain entities.
+
+
+=== Class definition
+
+For the domain class itself, this will be `@javax.jdo.annotations.PersistenceCapable` annotation and probably the `@javax.jdo.annotations.DatastoreIdentity`, as well as others to define indices and queries.
+
+[source,java]
+----
+@javax.jdo.annotations.PersistenceCapable(                              // <.>
+        identityType=IdentityType.DATASTORE,                            // <.>
+        schema = "simple",                                              // <.>
+        table = "SimpleObject"
+)
+@javax.jdo.annotations.DatastoreIdentity(                               // <.>
+        strategy=javax.jdo.annotations.IdGeneratorStrategy.IDENTITY,
+        column="id"
+)
+@javax.jdo.annotations.Version(                                         // <.>
+        strategy= VersionStrategy.DATE_TIME,
+        column="version"
+)
+@DomainObject(                                                          // <.>
+        logicalTypeName = "simple.SimpleObject"
+)
+public class SimpleObject { /* ... */ }
+----
+
+<.> The `@PersistenceCapable` annotation indicates that this is an entity to DataNucleus.
+The DataNucleus enhancer acts on the bytecode of compiled entities, injecting lazy loading and dirty object tracking functionality.
+Enhanced entities end up also implementing the `javax.jdo.spi.PersistenceCapable` interface.
+<.> Indicates how identifiers for the entity are handled.
+Using `DATASTORE` means that a DataNucleus is responsible for assigning the value (rather than the application).
+<.> Specifies the RDBMS database schema and table name for this entity will reside.
+It's recommended that the schema corresponds to the module in which the entity resides.
+The table will default to the entity name if omitted.
+<.> For entities that are using `DATASTORE` identity, indicates how the id will be assigned.
+A common strategy is to allow the database to assign the id, for example using an identity column or a sequence.
+<.> The `@Version` annotation is useful for optimistic locking; the strategy indicates what to store in the `version` column.
+<.> The `@DomainObject` annotation identifies the domain object to Apache Causeway (not DataNucleus).
+It isn't necessary to include this annotation -- at least, not for entities -- but it is nevertheless recommended.
+In particular, its strongly recommended that the `logicalTypeName` (which acts like an alias to the concrete domain class) is specified; note that it corresponds to the schema/table for DataNucleus' `@PersistenceCapable` annotation.
+
+
+=== Scalar Properties
+
+All domain entities will have some sort of mandatory key properties.
+Additional annotations are also required to define their scalar properties and relationships to other entities.
+
+The example below is a very simple case, where the entity is identified by a `name` property.
+This is often used in database unique indices, and in the `toString()` implementation:
+
+[source,java]
+----
+import javax.jdo.annotations.Column;
+import javax.jdo.annotations.Unique;
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import lombok.ToString.Include;
+...
+@Unique(
+    name="SimpleObject_name_UNQ", members = {"name"})               // <.>
+@ToString(onlyExplicitlyIncluded = true)
+public class SimpleObject
+             implements Comparable<SimpleObject> {                  // <.>
+
+    public SimpleObject(String name) {
+        setName(name);
+    }
+
+    @Column(allowsNull="false", length=50)                          // <.>
+    @Getter @Setter                                                 // <.>
+    @ToString.Include                                               // <.>
+    private String name;
+
+    private final static Comparator<SimpleObject> comparator =
+            Comparator.comparing(SimpleObject::getName);
+
+    @Override
+    public int compareTo(final SimpleObject other) {
+        return comparator.compare(this, other);                     // <.>
+    }
+}
+----
+<.> DataNucleus will automatically add a unique index to the primary surrogate id (discussed above), but additional alternative keys can be defined using the `@Unique` annotation.
+In the example above, the "name" property is assumed to be unique.
+<.> Although not required, we strongly recommend that all entities are naturally `Comparable`.
+This then allows parent/child relationships to be defined using ``SortedSet``s; RDBMS after all are set-oriented.
+<.> Chances are that some of the properties of the entity will be mandatory, for example any properties that represent an alternate unique key to the entity.
+The `@Column` annotation specifies the length of the column in the RDBMS, and whether it is mandatory.
++
+Given there is a unique index on `name`, we want this to be mandatory.
++
+We can also represent this using a constructor that defines these mandatory properties.
+The ORM will create a no-arg constructor to allow domain entity to be rehydrated from the database at runtime (it then sets all state reflectively).
+
+<.> Use Lombok to generate the getters and setters for the `name` property itself.
+<.> Use Lombok to create a `toString()` implementation that includes the value of `name` property.
+
+<.> Use `java.util.Comparator#comparing()` to implement `Comparable` interface.
+
+
+=== Queries
+
+When using JDO, it's also common for domain entities to have queries annotated on them.
+These are used by repository domain services to query for instances of the entity:
+
+[source,java]
+----
+...
+@javax.jdo.annotations.Queries({
+    @javax.jdo.annotations.Query(                                     // <.>
+      name = "findByName",                                            // <.>
+      value = "SELECT "                                               // <.>
+            + "FROM domainapp.modules.simple.dom.impl.SimpleObject "  // <.>
+            + "WHERE name.indexOf(:name) >= 0 ")                      // <.>
+})
+...
+public class SimpleObject { /* ... */ }
+----
+<.> There may be several `@Query` annotations, nested within a `@Queries` annotation) defines queries using JDOQL.
+
+<.> Defines the name of the query.
+
+<.> The definition of the query, using JDOQL syntax.
+
+<.> The fully-qualified class name. +
+Must correspond to the class on which the annotation is defined (the framework checks this automatically on bootstrapping).
+
+<5> In this particular query, is an implementation of a LIKE "name%" query.
+
+JDO/DataNucleus provides several APIs for defining queries, including entirely programmatic and type-safe APIs; but JDOQL is very similar to SQL and so easily learnt.
+
+To actually use the above definition, the framework provides the xref:refguide:applib:index/services/repository/RepositoryService.adoc[RepositoryService].
+This is a generic repository for any domain class.
+
+The corresponding repository method for the above query is:
+
+[source,java]
+----
+public List<SimpleObject> findByName(String name) {
+    return repositoryService.allMatches(            // <.>
+            Query.named(SimpleObject.class,         // <.>
+                        "findByName")               // <.>
+                   .withParameter("name", name)     // <.>
+            );
+}
+
+@Inject RepositoryService repositoryService;
+----
+<.> find all instances that match the query
+<.> Specifies the class that is annotated with `@Query`
+<.> Corresponds to the `@Query#name` attribute
+<.> Corresponds to the `:name` parameter in the query JDOQL string
+
+
+
diff --git a/antora/components/userguide/modules/ROOT/partials/domain-services/introduction.adoc b/antora/components/userguide/modules/ROOT/partials/domain-services/_intro.adoc
similarity index 100%
rename from antora/components/userguide/modules/ROOT/partials/domain-services/introduction.adoc
rename to antora/components/userguide/modules/ROOT/partials/domain-services/_intro.adoc
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/domain-services/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/domain-services/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/domain-services/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/drop-down-and-defaults/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/drop-down-and-defaults/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/drop-down-and-defaults/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/drop-down-and-defaults/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/drop-down-and-defaults/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/drop-down-and-defaults/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/events/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/events/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/events/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/events/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/events/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/events/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/meta-annotations/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/meta-annotations/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/meta-annotations/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/meta-annotations/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/meta-annotations/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/meta-annotations/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/mixins/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/mixins/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/mixins/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/mixins/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/mixins/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/mixins/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/modules/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/modules/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/modules/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/modules/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/modules/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/modules/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/object-members/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/object-members/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/object-members/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/ui/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/ui/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/ui/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/ui/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/ui/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/ui/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/value-types/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/value-types/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/value-types/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/value-types/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/value-types/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/value-types/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/view-models/_intro.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/view-models/_intro.adoc
index d7848f03b8..b55cfe7faa 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/view-models/_intro.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[introduction]]
+= Introduction
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc b/antora/components/userguide/modules/ROOT/partials/view-models/progmodel.adoc
similarity index 77%
copy from antora/components/userguide/modules/ROOT/pages/domain-services.adoc
copy to antora/components/userguide/modules/ROOT/partials/view-models/progmodel.adoc
index d7848f03b8..e1b8ff079a 100644
--- a/antora/components/userguide/modules/ROOT/pages/domain-services.adoc
+++ b/antora/components/userguide/modules/ROOT/partials/view-models/progmodel.adoc
@@ -1,10 +1,6 @@
-= Domain Services
+[[programming-model]]
+= Programming Model
 
 :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 [...]
-
-
-
-include::partial$domain-services/introduction.adoc[leveloffset=+1]
-include::partial$domain-services/inject-services.adoc[leveloffset=+1]
-include::partial$domain-services/crud.adoc[leveloffset=+1]
+:page-partial:
 
diff --git a/antora/components/userguide/modules/btb/pages/programming-model.adoc b/antora/components/userguide/modules/btb/pages/programming-model.adoc
index 67c8184f95..f04efc2943 100644
--- a/antora/components/userguide/modules/btb/pages/programming-model.adoc
+++ b/antora/components/userguide/modules/btb/pages/programming-model.adoc
@@ -5,9 +5,6 @@
 :page-partial:
 
 
-This chapter explains the main APIs to extend or alter the programming conventions that Apache Causeway understands to
-build up its metamodel.
-
-
+include::partial$programming-model/_intro.adoc[leveloffset=+1]
 include::partial$programming-model/custom-validator.adoc[leveloffset=+1]
 include::partial$programming-model/finetuning.adoc[leveloffset=+1]
diff --git a/antora/components/userguide/modules/ROOT/pages/programming-model.adoc b/antora/components/userguide/modules/btb/partials/programming-model/_intro.adoc
similarity index 99%
rename from antora/components/userguide/modules/ROOT/pages/programming-model.adoc
rename to antora/components/userguide/modules/btb/partials/programming-model/_intro.adoc
index 441085fb95..d9f62a989a 100644
--- a/antora/components/userguide/modules/ROOT/pages/programming-model.adoc
+++ b/antora/components/userguide/modules/btb/partials/programming-model/_intro.adoc
@@ -1,7 +1,8 @@
-= Programming Model
+[[introduction]
+= Introduction
 
 :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 [...]
-
+:page-partial:
 
 Apache Causeway works by building a xref:background-context-and-theory.adoc#metamodel[metamodel] of the domain objects: entities, domain services, view models and mixins.
 Dependent on the xref:overview.adoc#type-of-domain-objects[sort of domain object], the class methods represent both state -- (single-valued) xref:object-members.adoc#properties[properties] and (multi-valued) xref:object-members.adoc#collections[collections] -- and behaviour -- xref:object-members.adoc#actions[actions].