Details
-
Improvement
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.0-M5
-
None
-
None
Description
its presence seemed to mask out an issue with h2 and prototyping, where DN failed to create the tables due to no schema.
In the entity, we had:
@PersistenceCapable(schema="organisation")
and in application.properties, we declared :
isis.persistence.schema.auto-create-schemas=organisation
However, lower-case schema seemingly aren't supported by h2; these are created upper case, at least.
So, the above doesn't work, we see this error when try to interact with table:
An exception was thrown while adding/validating class(es) : Schema "organisation" not found; SQL statement: CREATE TABLE "organisation"."Currency" ( "id" BIGINT NOT NULL IDENTITY, "name" VARCHAR(50) NOT NULL, "reference" VARCHAR(24) NOT NULL, "version" BIGINT NOT NULL, CONSTRAINT "Currency_PK" PRIMARY KEY ("id") ) [90079-200] org.h2.jdbc.JdbcSQLSyntaxErrorException: Schema "organisation" not found; SQL statement: CREATE TABLE "organisation"."Currency" ( "id" BIGINT NOT NULL IDENTITY, "name" VARCHAR(50) NOT NULL, "reference" VARCHAR(24) NOT NULL, "version" BIGINT NOT NULL, CONSTRAINT "Currency_PK" PRIMARY KEY ("id") ) [90079-200] at org.h2.message.DbException.getJdbcSQLException(DbException.java:576) at org.h2.message.DbException.getJdbcSQLException(DbException.java:429) at or
The fix is to make everything upper case.
@PersistenceCapable(schema="ORGANISATION")
Now, for a while it looked like the persistence-unit name mattered, but it was a red herring; everything works with or without this file.
<?xml version="1.0" encoding="UTF-8" ?> <persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" version="1.0"> <persistence-unit name="organisation"> </persistence-unit> </persistence>
So, to avoid chasing phantoms, let's just delete this file.