运行 SynchronizeMappings 时出现 PersistenceException

发布于 2024-12-04 15:13:28 字数 3105 浏览 0 评论 0原文

我有使用 apache openJPA 的 eclipse 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

问题出在哪里?持久性如何记住该表或实体? 有必要清洁一下吗?我已经清理过项目几次了...

谢谢

I have eclipse java project using apache openJPA. Has eclipse got some kind of cache need to be clean?

I had one class , UsaState ...mapped to USA_STATE table. I have removed it from database, from persistence.xml, from project, from references in mappings ...there are no other referenced project and I have this error :

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

Where could be the problem? In what way could persistence remember that table or entity?
Is there neccesary some clean? I have already cleaned project some times...

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

左秋 2024-12-11 15:13:28

请移至 JPA >= 2.0.0 的较新版本。

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

Please move to a newer version of JPA >= 2.0.0.

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

浅笑依然 2024-12-11 15:13:28

尝试重新启动数据库或执行命令刷新表

Try restarting your database or execute command flush tables.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文