运行SynchronizeMappings时出现PersistenceException

时间:2011-09-13 15:58:09

标签: java mysql eclipse openjpa

我使用apache openJPA删除了java项目。 eclipse有没有需要干净的某种缓存?

我有一个类,UsaState ...映射到USA_STATE表。我已经从数据库,persistence.xml,项目,映射中的引用中删除了它...没有其他引用的项目,我有这个错误:

Exception in thread "main"  org.apache.openjpa.persistence.PersistenceException:
    You have an error in your SQL syntax; check the manual that
    corresponds to your MySQL server version for the right syntax to use
    near 'TYPE = innodb' at line 1 {stmnt 7860099
        CREATE TABLE USA_STATE (
            ID BIGINT NOT NULL AUTO_INCREMENT,
            NAME VARCHAR(255),
            ADDRESS BIGINT,
            PRIMARY KEY (ID)
        ) TYPE = innodb
    } [code=1064, state=42000]
    at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:553)
    at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:453)
    at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.synchronizeMappings(JDBCBrokerFactory.java:159)
    at org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory.newBrokerImpl(JDBCBrokerFactory.java:119)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:189)
    at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:145)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:56)
    at TestMain.main(TestMain.java:18)
Caused by: org.apache.openjpa.lib.jdbc.ReportingSQLException: You have
    an error in your SQL syntax; check the manual that corresponds to
    your MySQL server version for the right syntax to use near 'TYPE =
    innodb' at line 1 {stmnt 7860099
        CREATE TABLE USA_STATE (
            ID BIGINT NOT NULL AUTO_INCREMENT,
            NAME VARCHAR(255),
            ADDRESS BIGINT,
            PRIMARY KEY (ID)
        ) TYPE = innodb
    } [code=1064, state=42000]
    at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.wrap(LoggingConnectionDecorator.java:192)
    at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator.access$700(LoggingConnectionDecorator.java:57)
    at org.apache.openjpa.lib.jdbc.LoggingConnectionDecorator$LoggingConnection$LoggingStatement.executeUpdate(LoggingConnectionDecorator.java:762)
    at org.apache.openjpa.lib.jdbc.DelegatingStatement.executeUpdate(DelegatingStatement.java:114)
    at org.apache.openjpa.jdbc.schema.SchemaTool.executeSQL(SchemaTool.java:1191)
    at org.apache.openjpa.jdbc.schema.SchemaTool.createTable(SchemaTool.java:949)
    at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:526)
    at org.apache.openjpa.jdbc.schema.SchemaTool.add(SchemaTool.java:344)
    at org.apache.openjpa.jdbc.schema.SchemaTool.run(SchemaTool.java:321)
    at org.apache.openjpa.jdbc.meta.MappingTool.record(MappingTool.java:501)
    ... 9 more

哪里可能是问题?持久化以什么方式记住该表或实体? 有必要干一些吗?我已经清理了一些项目......

由于

2 个答案:

答案 0 :(得分:1)

请转到较新版本的JPA> = 2.0.0。

https://issues.apache.org/jira/browse/OPENJPA-1530

答案 1 :(得分:-1)

尝试重新启动数据库或执行命令flush tables