我在使用 JPA 和嵌入式 derby 数据库的 Netbeans 平台应用程序中看到了这个输出。如果我的数据库尚不存在,我希望在用户根目录中创建我的数据库,因此用户无需进行其他配置。有谁知道下面的异常消息或警告是否会成为问题?
derby.system.home=/home/simgineer/.simdriver
derby.stream.error.file=/home/simgineer/.simdriver/log/derby.log
[EL Info]: 2012-09-12 11:46:42.397--ServerSession(177592104)--file:/home/simgineer/NetBeansProjects/SimDriver/build/cluster/modules/ext/MyDbLib.jar_VmCfgLibPU login successful
Database Class Loader started - derby.database.classpath=''
[EL Warning]: 2012-09-12 11:46:42.763--ServerSession(177592104)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table/View 'VMCFG' already exists in Schema 'APP'.
Error Code: 30000
Call: CREATE TABLE APP.VMCFG (ID BIGINT NOT NULL, BOOT VARCHAR(30), CDROM VARCHAR(60), CPU VARCHAR(30), ENABLEKVM SMALLINT, HDA VARCHAR(80), MACADDR VARCHAR(30), SOUNDHW VARCHAR(30), VMNAME VARCHAR(30) NOT NULL, PRIMARY KEY (ID))
Query: DataModifyQuery(sql="CREATE TABLE APP.VMCFG (ID BIGINT NOT NULL, BOOT VARCHAR(30), CDROM VARCHAR(60), CPU VARCHAR(30), ENABLEKVM SMALLINT, HDA VARCHAR(80), MACADDR VARCHAR(30), SOUNDHW VARCHAR(30), VMNAME VARCHAR(30) NOT NULL, PRIMARY KEY (ID))")
[EL Warning]: 2012-09-12 11:46:42.876--ServerSession(177592104)--Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Table/View 'SEQUENCE' already exists in Schema 'APP'.
Error Code: 30000
Call: CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))
Query: DataModifyQuery(sql="CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))")
这是我的persistence.xml
<persistence version="2.0" 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_2_0.xsd">
<persistence-unit name="VmCfgLibPU" transaction-type="RESOURCE_LOCAL">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<class>mycompany.jpa.Vmcfg</class>
<properties>
<property name="javax.persistence.jdbc.url" value="jdbc:derby:myDB;create=true"/>
<property name="javax.persistence.jdbc.password" value="app"/>
<property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/>
<property name="javax.persistence.jdbc.user" value="app"/>
<property name="eclipselink.ddl-generation" value="create-tables"/>
</properties>
</persistence-unit>
</persistence>