2016-06-09 2 views
0

최대 절전 모드에서 Wildfly 10을 사용하고 있으며 @ManyToOne의 Lazy Fetches가 무시된다는 것을 알았습니다.Wildfly 10 Hibernate Lazy Fetch가 작동하지 않습니다.

@Entity 
@Table(name = "storytitles") 
public class Storytitle implements Serializable { 
    @Id 
    private Long sid; 

    @ManyToOne(fetch=FetchType.LAZY) 
    @JoinColumn(name = "activator_uid") 
    private User user; 

의 persistence.xml :

<?xml version="1.0" encoding="UTF-8"?> 
<persistence version="2.1" 
    xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> 
    <persistence-unit name="services"> 
     <jta-data-source>java:/jdbc/ds</jta-data-source> 
     <shared-cache-mode>ENABLE_SELECTIVE</shared-cache-mode> 
     <properties> 
      <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQL82Dialect" /> 
      <property name="hibernate.show_sql" value="true" /> 
      <property name="hibernate.hbm2ddl.auto" value="validate" /> 
      <property name="hibernate.ejb.use_class_enhancer" value="true"/> 
     </properties> 
    </persistence-unit> 
</persistence> 

나는 간단한 em.find (Storytitle.class, 1L)을 할 때, Storytitle을로드 한 후 사용자에 대한 쿼리를 볼 수 있습니다.

서버 시작에 나는 다음과 같은 logentry를 참조하십시오

22:54:16,113 INFO [org.hibernate.tuple.entity.EntityMetamodel] (ServerService Thread Pool -- 58) HHH000157: Lazy property fetching available for: model.Storytitle 

그래서 로그 라인은 바이트 코드 수단이 작동 말한다. 내가 확인할 수있는 어떤 아이디어? 이 클래스에는 최종 수식어가 없습니다.

안부, m

답변

1

가 나는 문제를 발견했다. 잘 작동 제거한 후

<property name="hibernate.ejb.use_class_enhancer" value="true"/>

:

내의 persistence.xml에서이 설정

은 lazy 페칭을 엉망.

관련 문제