Database Schemas

In the same way that Java packages act as a namespace for domain objects, it’s good practice to map domain entities to their own (database) schemas. (For more on database schemas, see for example here).

We recommend all the entities within a module use the same schema, and moreover that the object type also follows the same pattern.

For example, SecMan' JPA implementation resides in the IsisModuleExtSecmanPersistenceJpa module. Its ApplicationUser entity is defined as:

ApplicationUser.java
@Entity
@Table(
        schema = "isisExtensionsSecman",
        name = "ApplicationUser",
        ...
)
public class ApplicationUser ... { /* ... */ }

which results in a CREATE TABLE statement of:

CREATE TABLE isisExtensionsSecman."ApplicationUser" (
    ...
)

Configuring Schemas

While it is good practice to place tables in schemas, the ORMs do not by default actually create those schema (as per CREATE SCHEMA statement).

The framework therefore allows this to be configured: