OpenJPA 逆向工程 - 无法让 ReverseMappingTool 正确生成实体
我将 openjpa 的 ReverseMappingTool 作为 Mavin 插件放置,迫切希望生成至少与 EclipseLink 生成的实体类一样好的实体类。
它生成实体类,但无论我选择什么选项,实体类都没有注释(是的,我将 RMT 的 -annotations 设置为 true)。
还有其他事情比这更糟糕,例如 RMT 为每个 id 属性生成一个实体类。但如果您曾经使用过这个工具,请插话。经过 16 个小时的尝试解决这个问题,我现在不确定是我疯了,还是 OpenJPA 的 ReverseMappingTool 在 Vodka 上运行。
我从在 SO/某些网站中找到的 POM 开始。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.apache.openjpa.jdbc.meta.ReverseMappingTool</mainClass>
<commandlineArgs>
-directory src/main/java -accessType fields
-useGenericCollections true -package org.herennow.model
-metadata c -annotations true
-innerIdentityClasses false -useBuiltinIdentityClass false
-primaryKeyOnJoin true
</commandlineArgs>
<includePluginDependencies>true</includePluginDependencies>
</configuration>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.CR3</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-all</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
</plugin>
I place openjpa's ReverseMappingTool as a Mavin plugin in a desperate hope to generate entity classes that are at least as good as EclipseLink generated entity classes.
It generates the entity classes but no matter what options I choose, the entity classes have no Annotations (Yes I set -annotations to true for RMT).
There are other things that are going worse than this one, such as RMT generating an entity class for every id-attribute. But please chime in if you have ever worked with this tool.After 16 hours of trying to fix this problem, I'm now not sure if it's me who's gone crazy or is OpenJPA's ReverseMappingTool running on Vodka.
I started with this piece of POM I found in SO/some site.
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<mainClass>org.apache.openjpa.jdbc.meta.ReverseMappingTool</mainClass>
<commandlineArgs>
-directory src/main/java -accessType fields
-useGenericCollections true -package org.herennow.model
-metadata c -annotations true
-innerIdentityClasses false -useBuiltinIdentityClass false
-primaryKeyOnJoin true
</commandlineArgs>
<includePluginDependencies>true</includePluginDependencies>
</configuration>
<dependencies>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.CR3</version>
</dependency>
<dependency>
<groupId>org.apache.openjpa</groupId>
<artifactId>openjpa-all</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
</plugin>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论