HSQLDB Manager

The HsqlDbManagerMenu provides a single menu item to open up the HSQLDB manager. This is only enabled for prototyping, and if HSQLDB is detected in the underlying JDBC URL.

The menu appears under the "Prototyping" menu.

the HSQLDB Manager is a Swing application, so this can only be used in a local setting.

Maven Configuration

Dependency Management

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

pom.xml
<parent>
    <groupId>org.apache.causeway.app</groupId>
    <artifactId>causeway-app-starter-parent</artifactId>
    <version>2.1.0</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.causeway.core</groupId>
            <artifactId>causeway-core</artifactId>
            <version>2.1.0</version>
            <scope>import</scope>
            <type>pom</type>
        </dependency>
    </dependencies>
</dependencyManagement>

In addition, add an entry for the BOM of all the testing support libraries:

pom.xml
<dependencyManagement>
    <dependencies>
        <dependency>
        	<groupId>org.apache.causeway.testing</groupId>
	        <artifactId>causeway-testing</artifactId>
            <scope>import</scope>
            <type>pom</type>
            <version>2.1.0</version>
        </dependency>
    </dependencies>
</dependencyManagement>

Dependencies

In the domain module(s) of your application, add the following dependency:

pom.xml
<dependencies>
    <dependency>
        <groupId>org.apache.causeway.testing</groupId>
        <artifactId>causeway-testing-h2console-ui</artifactId>
    </dependency>
</dependencies>

Update AppManifest

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

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

API & Implementation

The API of the service is:

public class HsqlDbManagerMenu {
    public void hsqlDbManager() { /* ... */ }
}

Note that this launches the manager on the same host that the webapp runs, and so is only appropriate to use when running on localhost.

Disabling/hiding the menu

The menu can be hidden or disabled by subscribing to its domain event, eg:

import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;

@Service
public class HideHsqlDbManagerMenu {

    @EventListener(HsqlDbManagerMenu.ActionDomainEvent.class)
    public void on(HsqlDbManagerMenu.ActionDomainEvent ev) {
        ev.hide();
    }
}