[ 
https://issues.apache.org/jira/browse/ISIS-2660?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Daniel Keir Haywood resolved ISIS-2660.
---------------------------------------
    Resolution: Fixed

> For starter apps, remove persistence.xml (we can get by without it).
> --------------------------------------------------------------------
>
>                 Key: ISIS-2660
>                 URL: https://issues.apache.org/jira/browse/ISIS-2660
>             Project: Isis
>          Issue Type: Improvement
>    Affects Versions: 2.0.0-M5
>            Reporter: Daniel Keir Haywood
>            Assignee: Daniel Keir Haywood
>            Priority: Minor
>             Fix For: 2.0.0-M6
>
>
> 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:
> {code:java}
> @PersistenceCapable(schema="organisation") {code}
> and in application.properties, we declared :
> {code:java}
> isis.persistence.schema.auto-create-schemas=organisation {code}
>  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:
> {code:java}
> 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 {code}
>  
> The fix is to make everything upper case.  
> {code:java}
> @PersistenceCapable(schema="ORGANISATION") {code}
>  
>  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.
> {code:java}
> <?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>
>   {code}
>  
> So, to avoid chasing phantoms, let's just delete this file.
>  
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to