同一个 class 上的两个 EntityGraph 不工作 (EclipseLink)
Two EntityGraph on same class is not working (EclipseLink)
我正在尝试在我的 class 上添加第二个 EntityGraph。
@NamedEntityGraph( name = "foo.details", attributeNodes = {
@NamedAttributeNode("id" ),
@NamedAttributeNode( "bar" )})
@NamedEntityGraph( name = "foo.without.details",
attributeNodes = { @NamedAttributeNode( "id" ) } )
public class Foo{
存储库
@Override
@EntityGraph( value = "foo.without.details" )
Page<Foo> findAll(Predicate predicate, Pageable pageable );
如果我使用第二个 entityGraph 会得到跟随错误
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-6114] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.QueryException │
│ Exception Description: You must define a fetch group manager at descriptor (Foo) in order to set a fetch group on the query (null) │
│ Query: ReadAllQuery(referenceClass=Aspect sql="SELECT id FROM foo WHERE (description LIKE ? ESCAPE ? AND (tenant_id = ?)) ORDER BY id ASC") │
│ FetchGroup(foo.without.details){} │
│ at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:493) │
│ at com.querydsl.jpa.impl.AbstractJPAQuery.getResultList(AbstractJPAQuery.java:160)
我还尝试过,使用包装器注释“NamedEntityGraphs”并注释 spring 数据存储库。
@Override
@EntityGraph( attributePaths = "id" )
Page<Foo> findAll( Predicate predicate, Pageable pageable );
没有第二个 EntityGraph 一切正常:
已启用 Maven 静态编织并启用日志记录
有人知道哪里出了问题吗?
编辑:编织信息
[INFO] --- eclipselink-maven-plugin:2.7.5.1:weave (default) @
[INFO] Only entities from base packages 'foo' will be included in persistence.xml
[INFO] Entities found : 12
[INFO] persistence.xml location: [INFO] Eclipselink weaving completed
Class 文件
public class Foo implements PersistenceWeaved,PersistenceObject, PersistenceWeavedFetchGroups, PersistenceWeavedLazy, PersistenceWeavedChangeTracking
maven版本问题。升级到新的maven版本,一切正常!
我正在尝试在我的 class 上添加第二个 EntityGraph。
@NamedEntityGraph( name = "foo.details", attributeNodes = {
@NamedAttributeNode("id" ),
@NamedAttributeNode( "bar" )})
@NamedEntityGraph( name = "foo.without.details",
attributeNodes = { @NamedAttributeNode( "id" ) } )
public class Foo{
存储库
@Override
@EntityGraph( value = "foo.without.details" )
Page<Foo> findAll(Predicate predicate, Pageable pageable );
如果我使用第二个 entityGraph 会得到跟随错误
Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-6114] (Eclipse Persistence Services - 2.7.8.v20201217-ecdf3c32c4): org.eclipse.persistence.exceptions.QueryException │
│ Exception Description: You must define a fetch group manager at descriptor (Foo) in order to set a fetch group on the query (null) │
│ Query: ReadAllQuery(referenceClass=Aspect sql="SELECT id FROM foo WHERE (description LIKE ? ESCAPE ? AND (tenant_id = ?)) ORDER BY id ASC") │
│ FetchGroup(foo.without.details){} │
│ at org.eclipse.persistence.internal.jpa.QueryImpl.getResultList(QueryImpl.java:493) │
│ at com.querydsl.jpa.impl.AbstractJPAQuery.getResultList(AbstractJPAQuery.java:160)
我还尝试过,使用包装器注释“NamedEntityGraphs”并注释 spring 数据存储库。
@Override
@EntityGraph( attributePaths = "id" )
Page<Foo> findAll( Predicate predicate, Pageable pageable );
没有第二个 EntityGraph 一切正常:
已启用 Maven 静态编织并启用日志记录
有人知道哪里出了问题吗?
编辑:编织信息
[INFO] --- eclipselink-maven-plugin:2.7.5.1:weave (default) @
[INFO] Only entities from base packages 'foo' will be included in persistence.xml
[INFO] Entities found : 12
[INFO] persistence.xml location: [INFO] Eclipselink weaving completed
Class 文件
public class Foo implements PersistenceWeaved,PersistenceObject, PersistenceWeavedFetchGroups, PersistenceWeavedLazy, PersistenceWeavedChangeTracking
maven版本问题。升级到新的maven版本,一切正常!