[ https://issues.apache.org/jira/browse/OPENJPA-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12915019#action_12915019 ]
Milosz Tylenda commented on OPENJPA-1812: ----------------------------------------- I think H2 in in-memory mode destroys the database when the last connection to the database closes. Try this URL: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1 > Schema synchronizer fails to build tables and indexes when running with H2 > in-memory database > --------------------------------------------------------------------------------------------- > > Key: OPENJPA-1812 > URL: https://issues.apache.org/jira/browse/OPENJPA-1812 > Project: OpenJPA > Issue Type: Bug > Affects Versions: 2.0.1 > Reporter: Willis Blackburn > Priority: Minor > > Using the example from OPENJPA-1804 I added HostName and EmailAddress to the > class list, updated the JVM launcher command to use the Java agent enhancer, > and added: > <property name="openjpa.jdbc.SynchronizeMappings" > value="buildSchema(foreignKeys=true)"/> > Note also: > <property name="openjpa.ConnectionURL" value="jdbc:h2:mem:test"/> > When I tried to run the example, it failed when attempting to create an > index, saying that address_book_table (which it created a few milliseconds > earlier) did not exist. > Changing H2 to use a database on disk fixed the problem: > <property name="openjpa.ConnectionURL" > value="jdbc:h2:~/openjpatestdb"/> > But why is OpenJPA sensitive to whether I'm using an in-memory or disk H2 > database? > I tried opening the same in-memory database URL using my IDE's JDBC console. > Of course I got a different database, since the IDE is running in its own > JVM. But I was able to execute the "create table" from the OpenJPA log > followed by the "create index" without any trouble. -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.