Java Datanucleus autoCreateSchema问题(矛盾的错误消息)
我有一个小型的本地H2数据库,其内容是通过DataNucleus的JDO实现创建的。它包含与以下对象关联的RawContaineItem表:Java Datanucleus autoCreateSchema问题(矛盾的错误消息),java,h2,jdo,datanucleus,Java,H2,Jdo,Datanucleus,我有一个小型的本地H2数据库,其内容是通过DataNucleus的JDO实现创建的。它包含与以下对象关联的RawContaineItem表: @PersistenceCapable(objectIdClass=RawItemKey.class) @Index(name="CONTAIN_IDX", members={"prefix", "language", "value"}) public class RawContainItem { @PrimaryKey @Column(
@PersistenceCapable(objectIdClass=RawItemKey.class)
@Index(name="CONTAIN_IDX", members={"prefix", "language", "value"})
public class RawContainItem {
@PrimaryKey
@Column(length=40)
String prefix = "";
@PrimaryKey
@Column(length=2)
String language = "";
@PrimaryKey
@Column(length=Integer.MAX_VALUE)
String value = "";
public RawContainItem(String prefix, String language, String value) {
this.prefix = prefix;
this.language = language;
this.value = value;
}
}
此表当前包含几个language=FR的行。我想添加一些language=EN的行,但收到奇怪的错误消息
当datanucleus.autoCreateSchema设置为true时,我得到:
此消息是正确的,表确实存在
当datanucleus.autoCreateSchema设置为false时,我得到:
但是这个表确实存在。。。给出了什么?问题是,表RAWCONTAINITEM存在,但在不同的目录和架构中。目录名是数据库的名称,模式很可能是公共的。但是DataNucleus在目录空名称和架构空名称中搜索表。我只是不知道如何告诉DataNucleus在默认目录和模式中搜索……我来看看这个。我没有配置任何目录或架构。我希望违约能奏效。谢谢。问题是,表项存在,但在不同的目录和架构中。目录名是数据库的名称,模式很可能是公共的。但是DataNucleus在目录空名称和架构空名称中搜索表。我只是不知道如何告诉DataNucleus在默认目录和模式中搜索……我来看看这个。我没有配置任何目录或架构。我希望违约能奏效。谢谢
INFO: Managing Persistence of Class : net.dwst.findword.DataNucleus.RawContainItem [Table : RAWCONTAINITEM, InheritanceStrategy : new-table]
23-mars-2012 14:42:49 org.datanucleus.store.rdbms.table.AbstractTable create
INFO: Creating table RAWCONTAINITEM
23-mars-2012 14:42:50 org.datanucleus.store.rdbms.table.AbstractTable executeDdlStatementList
GRAVE: Error thrown executing CREATE TABLE RAWCONTAINITEM
(
"LANGUAGE" VARCHAR(2) NOT NULL,
PREFIX VARCHAR(40) NOT NULL,
"VALUE" VARCHAR(2147483647) NOT NULL,
CONSTRAINT RAWCONTAINITEM_PK PRIMARY KEY ("LANGUAGE",PREFIX,"VALUE")
) : Table "RAWCONTAINITEM" already exists; SQL statement:
CREATE TABLE RAWCONTAINITEM
(
"LANGUAGE" VARCHAR(2) NOT NULL,
PREFIX VARCHAR(40) NOT NULL,
"VALUE" VARCHAR(2147483647) NOT NULL,
CONSTRAINT RAWCONTAINITEM_PK PRIMARY KEY ("LANGUAGE",PREFIX,"VALUE")
) [42101-164]
org.h2.jdbc.JdbcSQLException: Table "RAWCONTAINITEM" already exists;
...
Required table missing : "RAWCONTAINITEM" in Catalog "" Schema "".
DataNucleus requires this table to perform its persistence operations.
Either your MetaData is incorrect, or you need to enable "datanucleus.autoCreateTables"
org.datanucleus.store.rdbms.exceptions.MissingTableException:
Required table missing : "RAWCONTAINITEM" in Catalog "" Schema "".
DataNucleus requires this table to perform its persistence operations.
Either your MetaData is incorrect, or you need to enable "datanucleus.autoCreateTables"
...