简体   繁体   English

eclipse现有maven项目添加jpa支持?

[英]eclipse existing maven project add jpa support?

how to add jpa support for existing maven project 如何为现有的maven项目添加jpa支持

i tried 我试过了

project-->configure--> convert to jpa project (there is no this option) project - > configure - >转换为jpa项目(没有这个选项)

but for my other projects, such option available... can comment? 但对于我的其他项目,这样的选项可以...评论?

I already have existing mven project and i want to generate jpa entity from tables. 我已经有了现有的mven项目,我想从表中生成jpa实体。 no need to create new jpa project right? 没有必要创建新的jpa项目吗?

I'm not sure but I think that you need to setup your project to use the JPA Facet (right click on the project the Properties > Project Facets and select Java Persistence ). 我不确定,但我认为您需要设置项目以使用JPA Facet(右键单击项目Properties > Project Facets并选择Java Persistence )。 I don't know if m2eclipse can add this facet automatically. 我不知道m2eclipse是否可以自动添加这个方面。

But actually, with the version of Eclipse I'm using, adding the JPA facet doesn't add any entry for JPA under Configure when I right click on a project. 但实际上,使用我正在使用的Eclipse版本,添加JPA facet时,在我右键单击项目时,不会在Configure下为JPA添加任何条目。 It adds a menu JPA Tools > Generate Entities from Tables... (and JPA Tools > Generate Tables from Entities... ). 它添加了一个菜单JPA Tools > Generate Entities from Tables ... (和JPA Tools > Generate Tables from Entities ... )。

Be sure to coordinate your Maven dependencies with the Eclipse JPA configuration. 确保使用Eclipse JPA配置协调Maven依赖项。 By default, Eclipse uses EclipseLink as its JPA implementation, which would require the use of a specific repository location and set of dependencies for the associated components in your project POM. 默认情况下,Eclipse使用EclipseLink作为其JPA实现,这需要使用特定的存储库位置和项目POM中相关组件的依赖关系集。 If you choose to use EclipseLink rather than another JPA user library, ensure that the version numbers are consistent between the Eclipse and Maven configuration settings. 如果选择使用EclipseLink而不是另一个JPA用户库,请确保Eclipse和Maven配置设置之间的版本号一致。 More information on Eclipse and Maven/Eclipse configuration can be found at: http://www.eclipse.org/eclipselink/downloads/ . 有关Eclipse和Maven / Eclipse配置的更多信息,请访问: http//www.eclipse.org/eclipselink/downloads/

Use the 'EclipseLink P2 Repository' info to set up your workbench EclipseLink version and libraries, and follow the 'EclipseLink Maven Repository' link to set up your project POM to match it. 使用'EclipseLink P2 Repository'信息设置工作台EclipseLink版本和库,并按照'EclipseLink Maven Repository'链接设置项目POM以匹配它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM