[英]Hibernate configuration in Eclipse Luna
I installed the Hibernate plug-in on Eclipse from here . 我从这里在Eclipse上安装了Hibernate插件。
Installation is successful-- I'm now seeing Hibernate
as an option in Window > Open Perspective
. 安装成功-我现在在“
Window > Open Perspective
看到“ Hibernate
”选项。
I've set the properties on the project itself-- Enable Hibernate support
is now checked in Properties > Hibernate Settings
. 我已经在项目本身上设置了属性-现在在“
Properties > Hibernate Settings
选中“ Enable Hibernate support
Properties > Hibernate Settings
。 Also, Hibernate Builder
is checked (was automatically) in Properties Builders
. 同样,在
Properties Builders
检查(自动)了Hibernate Builder
。
However, Java is not seeing Hibernate-- I'm getting errors to all Hibernate imports in my source code. 但是,Java没有看到Hibernate,我的源代码中的所有Hibernate导入都出错了。 When I attempt to "Fix project setup..." in the editor, I get "No proposals found ... click for manual configuration."
当我尝试在编辑器中“修复项目设置...”时,出现“找不到建议...单击以进行手动配置”。
What am i missing? 我错过了什么?
I downloaded Hibernate plug-in to get around this manual fix for one thing. 我下载了Hibernate插件来解决此手动修复问题。 The same code is working all fine when I manually add the jars to the project build path.
当我将jar手动添加到项目构建路径时,相同的代码可以正常工作。
I'm using Eclipse Luna 4.4.2 我正在使用Eclipse Luna 4.4.2
TIA. TIA。
//------------------------- // -------------------------
EDIT: 编辑:
While autocreating persistence.xml
, Eclipse is (must be) looking at the version of Hibernate plug-in, not the jars on the project's build-path. 在自动创建
persistence.xml
,Eclipse(必须)正在查看Hibernate插件的版本,而不是项目的构建路径上的jar。
And that's causing a version conflict in between JPA and ORM. 这导致JPA和ORM之间发生版本冲突。 See the accepted answer here for reference.
请参阅此处接受的答案以供参考。
Burned me half a day. 烧了我半天。
The plug-ins make Eclipse Hibernate-aware, not necessarily your project . 这些插件使Eclipse能够识别Eclipse ,而不一定是您的项目 。 Your project still must be configured (either manually or via a dependency management tool like Maven or Gradle) with the appropriate Hibernate JARs.
您的项目仍必须使用适当的Hibernate JAR进行配置(手动或通过诸如Maven或Gradle之类的依赖管理工具)。 It's the difference between development-time (the Eclipse plug-ins), compile-time (JARs on the build path) and runtime (JARs on the runtime classpath).
这是开发时间(Eclipse插件),编译时间(构建路径上的JAR)和运行时(运行时类路径上的JAR)之间的区别。
It would be nice if the plug-in provided a Quick Fix (à la Fix project setup... ) that offered to download and/or add Hibernate JARs to your project, but as far as I know that's not something they implemented. 如果该插件提供了一个Quick Fix(即Fix project setup ... ),可以将Hibernate JAR下载和/或添加到您的项目中,那就太好了,但据我所知,这并不是他们实现的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.