Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 从JPA/EclipseLink在内存中生成HSQLDB表(无文件)_Java_Jpa_Eclipselink_Hsqldb_In Memory Database - Fatal编程技术网

Java 从JPA/EclipseLink在内存中生成HSQLDB表(无文件)

Java 从JPA/EclipseLink在内存中生成HSQLDB表(无文件),java,jpa,eclipselink,hsqldb,in-memory-database,Java,Jpa,Eclipselink,Hsqldb,In Memory Database,我有带EclipseLink 2.4的JPA2,我正在尝试使用HSQLDB实现内存中的数据库。我已经能够使用 jdbc:hsqldb:file:./databases/test;shutdown=true;files_readonly=true 但是当我尝试使用jdbc:hsqldb:mem:tableName时,我得到了以下消息: 堆栈跟踪: javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Ecli

我有带EclipseLink 2.4的JPA2,我正在尝试使用HSQLDB实现内存中的数据库。我已经能够使用

jdbc:hsqldb:file:./databases/test;shutdown=true;files_readonly=true
但是当我尝试使用
jdbc:hsqldb:mem:tableName
时,我得到了以下消息:


堆栈跟踪:

javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse   
Persistence Services - 2.4.0.v20120608-r11652):  
  org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLSyntaxErrorException: user lacks privilege or object
  not found: EFFECTIVITY

Error Code: -5501
Call: INSERT INTO EFFECTIVITY (HULL) VALUES (?)
bind => [1 parameter bound]
Query: InsertObjectQuery(101)
at org.eclipse.persistence.internal.jpa.EntityManagerImpl.flush
       (EntityManagerImpl.java:804)
at com.gdeb.touchtable.db.TestJPAEntities.testTTTouch(TestJPAEntities.java:93)
..............
Caused by: org.hsqldb.HsqlException: user lacks privilege or object not found:
 EFFECTIVITY
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.error.Error.error(Unknown Source)
at org.hsqldb.SchemaManager.getTable(Unknown Source)
at org.hsqldb.ParserDQL.readTableName(Unknown Source)
at org.hsqldb.ParserDQL.readRangeVariableForDataChange(Unknown Source)
at org.hsqldb.ParserDML.compileInsertStatement(Unknown Source)
at org.hsqldb.ParserCommand.compilePart(Unknown Source)
at org.hsqldb.ParserCommand.compileStatement(Unknown Source)
at org.hsqldb.Session.compileStatement(Unknown Source)
at org.hsqldb.StatementManager.compile(Unknown Source)
at org.hsqldb.Session.execute(Unknown Source)
... 63 more


从我读到的内容来看,数据模型应该是自动生成的,但我只看到了Hibernate的例子。是否有方法链接JPA数据模型并使用HSQLDB的内存模式创建它?

如果缺少的是表,则需要将eclipselink.ddl-generation属性的值设置为“create tables”,以便eclipselink为您创建它们。这里发布了一个示例:

我正在几个不同的环境中进行测试,我不需要在之后保留数据,也不需要文件阻塞存储库,因此HSQLDB似乎是一个很好的方法。我没有使用内存中HSQLDB和JPA的经验。但是我成功地使用了H2数据库。@WernerVesterå的H2看起来也很有希望:)对于其他有同样问题的人,您可能必须为HSQLDB指定“目标数据库”属性:
eclipselink.target database
,即
org.eclipse.persistence.platform.database.HSQLPlatform
。我们应该在哪里使用此链接属性。请帮助我。