Setup and Configuration

This section describes how to include the JPA module and setup its configuration properties.

Maven pom.xml

Dependency Management

If your application inherits from the Apache Isis starter app (org.apache.isis.app:isis-app-starter-parent) then that will define the version automatically:

pom.xml
<parent>
    <groupId>org.apache.isis.app</groupId>
    <artifactId>isis-app-starter-parent</artifactId>
    <version>2.0.0-M6</version>
    <relativePath/>
</parent>

Alternatively, import the core BOM. This is usually done in the top-level parent pom of your application:

pom.xml
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.apache.isis.core</groupId>
            <artifactId>isis-core</artifactId>
            <version>2.0.0-M6</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

Dependency

For every Maven module that includes JPA entities, add the following dependency:

pom.xml
<dependencies>
    <dependency>
        <groupId>org.apache.isis.persistence</groupId>
        <artifactId>isis-persistence-jpa-eclipselink</artifactId>
        <type>pom</type>
    </dependency>
</dependencies>

Update AppManifest

In your application’s AppManifest (top-level Spring @Configuration used to bootstrap the app), import the

AppManifest.java
@Configuration
@Import({
        ...
        IsisModuleJpaEclipselink.class,
        ...
})
public class AppManifest {
}

DataSource

The JPA object store uses Spring to provide a javax.sql.DataSource. Normally this is done by setting the spring.datasource configuration properties, as described in the Spring Boot documentation.

For example, the SimpleApp starter app defines these:

  • for H2 (in-memory):

    app.properties
    spring.sql.init.platform=h2
    spring.datasource.url=jdbc:h2:mem:simple
    spring.datasource.driver-class-name=org.h2.Driver
  • for SQL Server:

    app.properties
    spring.sql.init.platform=sqlserver
    spring.datasource.url=jdbc:sqlserver://localhost;databaseName=simpleapp
    spring.datasource.driver-class-name=com.microsoft.sqlserver.jdbc.SQLServerDriver
    spring.datasource.username=simpleapp
    spring.datasource.password=simpleapp

It is also possible to programmatically define a DataSource; see the Spring docs for details.

The following configuration properties are set by default:

Generally these should not be changed, though if there is a requirement, then provide a subclasse alternate implementation of org.apache.isis.persistence.jpa.eclipselink.config.ElSettings with an earlier @Priority precedence.

To set other EclipseLink configuration properties, use a subclass of refguide:persistence:index/jpa/eclipselink/IsisModuleJpaEclipselink.adoc and override getVendorProperties().

Other Configuration Properties

The JPA object store also supports the following configuration properties:

  • isis.persistence.schema.additional-orm-files

    Lookup additional "mapping-files" in META-INF/orm-name.xml (equivalent to "mapping-file" entries in persistence.xml) and adds these to those that are already configured the Spring Data way (if any).