简体   繁体   English

在eclipseLink中使用@FetchGroup

[英]Using @FetchGroup with eclipseLink

I have tried to get source running as explained in http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_fetchgroup.htm 我试图按照http://eclipse.org/eclipselink/documentation/2.4/jpa/extensions/a_fetchgroup.htm中的说明运行源

@FetchGroup(name="names", 
    attributes={ 
         @FetchAttribute(name="firstName"),
         @FetchAttribute(name="lastName")
}) 


TypedQuery query = em.createQuery("SELECT e FROM Employee e", Employee.class);    
query.setHint(QueryHints.FETCH_GROUP_NAME, "names"); 

Sadly it ends up with "Needs to implement FetchGroupTracker". 可悲的是,它最终以“实现FetchGroupTracker的需求”结束。

I don't know if it is really the case or I'm missing something. 我不知道是不是真的,或者我缺少什么。 Does anybody know where I can find a sample for it? 有人知道我可以在哪里找到样品吗?

You must set up byte code weaving/enhancement for this to work automatically, otherwise your entities will need to implement the FetchGroupTracker class so that the fetch group attributes can be put into and used by your entity. 您必须设置字节码编织/增强功能才能自动工作,否则您的实体将需要实现FetchGroupTracker类,以便可以将获取组属性放入实体并由您的实体使用。 See https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving 参见https://wiki.eclipse.org/EclipseLink/UserGuide/JPA/Advanced_JPA_Development/Performance/Weaving

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

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