[英]How to use lazy property loading with glassfish + toplink essentials
I have a query: 我有一个查询:
select p from Product p
Which gives me the results I expect, but one of the columns (let's call it massiveDescription
) is big, and since I'm querying the full list of products I want to exclude it. 这给了我预期的结果,但是其中一列(我们称其为
massiveDescription
)很大,并且由于我要查询的是产品的完整列表,因此我想排除它。
I added @Basic(fetch=FetchType.LAZY)
to getMassiveDescription()
but this made no difference (the generated sql still includes all columns). 我在
getMassiveDescription()
添加了@Basic(fetch=FetchType.LAZY)
, getMassiveDescription()
没有区别(生成的sql仍然包括所有列)。
I'm using glassfish pretty much out of the box, and it uses toplink essentials. 我几乎是开箱即用的使用glassfish,它使用了toplink要素。 I thought there might be something I had to do to configure the agent, so I tried adding
-javaagent:/path/to/toplink-essentials-agent.jar
in the JVM options through the glassfish web interface. 我以为可能需要做一些配置代理程序的工作,所以我尝试通过glassfish Web界面在JVM选项中添加
-javaagent:/path/to/toplink-essentials-agent.jar
。 Then I get an exception: 然后我得到一个例外:
java.lang.NoClassDefFoundError: javax/transaction/Synchronization
at ...
So I figure I need to add jta.jar
to the classpath suffix box in the glassfish web ui. 所以我想我需要在glassfish Web ui的classpath后缀框中添加
jta.jar
。 That gives me a different exception: 那给了我一个不同的例外:
java.lang.NoClassDefFoundError: oracle/toplink/essentials/transaction/JTASynchronizationListener
at oracle.toplink.essentials.transaction.JTATransactionController.<init>...
So now I'm chasing jars. 所以现在我在追罐子。 I add
toplink-essentials.jar
to the classpath in the same way, but I still get the same exception. 我以相同的方式将
toplink-essentials.jar
添加到类路径中,但是仍然遇到相同的异常。
I have a few questions: 我有几个问题:
select p
for select p.id, p.name, ...
gives me strange errors - but I was only guessing at the syntax anyway. select p
select p.id, p.name, ...
为select p.id, p.name, ...
会给我带来奇怪的错误-但是我只是在猜测语法。 Turns out toplink essentials doesn't support this. 事实证明toplink基本要素不支持此功能。 Eclipselink does, so looks like I'm moving ORMs.
Eclipselink可以,所以看起来我正在移动ORM。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.