如何阻止 Eclipse 上的 JPA Facet 一直更新?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7359800/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How do I stop JPA Facet on Eclipse from updating all the time?
提问by Zds
I have a EJB2/EJB3 Java project in Eclipse. I recently enabled JPA Facet and now installed Dali and configured access to the MySQL DB containing the actual tables and data.
我在 Eclipse 中有一个 EJB2/EJB3 Java 项目。我最近启用了 JPA Facet,现在安装了 Dali 并配置了对包含实际表和数据的 MySQL 数据库的访问。
The problem is, editing entity beans in IDE Java editor became 100-1000 times slower. Write one word, see "Update JPA Project" appear on status bar, wait 30 seconds CPU under high load, Eclipse totally unresponsive, then continue and write next word..
问题是,在 IDE Java 编辑器中编辑实体 bean 的速度变慢了 100-1000 倍。写一个字,看到状态栏出现“Update JPA Project”,在高负载下等待30秒CPU,Eclipse完全没有响应,然后继续写下一个字..
The project that makes JPA slow is medium-sized, not just a simple webstore, but not enterprise-class either. I count 42 Stateless Session Beans and 49 Entity Beans. We actually have more entity beans, but many of them have not yet been converted to EJB 3, but are mapped only with EJB 2.1 instead.
使JPA变慢的项目是中等规模的,不仅仅是一个简单的webstore,也不是企业级的。我数了 42 个无状态会话 Bean 和 49 个实体 Bean。我们实际上有更多的实体 bean,但其中许多尚未转换为 EJB 3,而是仅映射到 EJB 2.1。
The longest of the session beans spans 20616 lines, longest methods being a hair below 2k lines.
最长的会话 bean 跨越 20616 行,最长的方法是低于 2k 行的头发。
The slowness of JPA is so severe, it makes also typingcode slow. After every 5-10 characters the Eclipse goes into complete halt for several seconds and content-assist is almost unusable, because it keeps triggering Eclipse's internal time-outs.
JPA 的速度太慢了,它也使得输入代码变慢。每 5-10 个字符后,Eclipse 就会完全停止几秒钟,内容辅助几乎无法使用,因为它不断触发 Eclipse 的内部超时。
So, the question is: How do I keep the JPA Facet enabled for the project and still make it not lag all the real work? Some simple toggle switch that would just disable the JPA part and then later re-enable would be lovely.
所以,问题是:我如何保持为项目启用 JPA Facet 并且仍然使它不滞后于所有实际工作?一些简单的切换开关,它只会禁用 JPA 部分,然后再重新启用会很可爱。
采纳答案by Karen Butzke
In Juno the Dali project has made several performance improvements that should help with your situation. We also made changes to push some of our work to background threads and use the Eclipse Jobs framework.
在 Juno 中,Dali 项目进行了多项性能改进,应该会对您的情况有所帮助。我们还进行了更改以将我们的一些工作推送到后台线程并使用 Eclipse 作业框架。
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=370407
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=377039
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=376787
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=336403
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=370407
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=377039
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=376787
- https://bugs.eclipse.org/bugs/show_bug.cgi?id=336403
If you still see performance lags in Juno I would greatly appreciate you sending us some performance profiling information. I could attempt to use your results in my work to improve performance (In Juno SR1 if possible). I've had success using the Java VisualVM included in jdk1.6.0_31. I set the profiler CPU settings to 'Start profiling from classes:' org.eclipse.jpt.**, uncheck 'Profile new Runnables', and 'Profile only classes:' org.eclipse.jpt.*. Then you could run one of your use cases that causes issues and attach the resulting snapshot to an eclipse bug (WebTools-Dali Jpa Tools).
如果您仍然看到 Juno 中的性能滞后,我将非常感谢您向我们发送一些性能分析信息。我可以尝试在我的工作中使用您的结果来提高性能(如果可能,在 Juno SR1 中)。我使用 jdk1.6.0_31 中包含的 Java VisualVM 取得了成功。我将分析器 CPU 设置设置为“从类开始分析:”org.eclipse.jpt.**,取消选中“Profile new Runnables”和“Profile only classes:”org.eclipse.jpt.*。然后,您可以运行导致问题的用例之一,并将生成的快照附加到 Eclipse 错误(WebTools-Dali Jpa 工具)。
回答by Jose Tepedino
A friend of mine has recently shown me a way to disable the constant "JPA Facet" updates after "Maven update" operations.
我的一个朋友最近向我展示了一种在“Maven 更新”操作后禁用持续“JPA Facet”更新的方法。
Please try this: on menu Window >> Preferences >> Maven >> Java EE Integration
请试试这个:在菜单窗口 >> 首选项 >> Maven >> Java EE 集成
- disable the "JPA Configurator" option.
- 禁用“JPA 配置器”选项。
回答by Lukas Eder
I just turned off all validation by Eclipse via Preferences > Validation > suspend all validators
:
我刚刚通过Preferences > Validation > suspend all validators
以下方式关闭了 Eclipse 的所有验证:
I don't remember the last time I ever needed validation, or thought that it was a useful feature in the first place. If you want to help your whole team, you can also check in the following file in each of your projects' .settings/org.eclipse.wst.validation.prefs
files:
我不记得上次我需要验证是什么时候,或者首先认为这是一个有用的功能。如果您想帮助整个团队,您还可以在每个项目的.settings/org.eclipse.wst.validation.prefs
文件中签入以下文件:
DELEGATES_PREFERENCE=delegateValidatorList
USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationtrueversion1.2.600.v201501211647
eclipse.preferences.version=1
override=true
suspend=true
vf.version=3
This has the same effect, but can be checked into version control.
这具有相同的效果,但可以签入版本控制。
And suddenly, the CPU cooler is extremely quiet again.
突然之间,CPU 散热器再次变得异常安静。
回答by Sergio Gabari
You can also look for this entry in any org.eclipse.wst.common.project.facet.core.xmlfile
您还可以在任何org.eclipse.wst.common.project.facet.core.xml文件中查找此条目
<installed facet="jpt.jpa" version="1.0"/>
and remove it
并删除它