我正在使用spring-jpa-data 2.0.5.RELEASE和eclipselink 2.6.4。
我已经定义了两个实体:
OrderItem具有定义为惰性的多对一关系:
@ManyToOne(fetch=FetchType.LAZY, optional=false)
@JoinColumn(name = "COD_PRODUCT_V")
private Product product;
但是当存在OrderItem实体的jpa存储库时,惰性关系不起作用。
public interface OrderItemRepository extends JpaRepository<OrderItem, String>
如果从我的源代码中删除OrderItem JPA存储库,则惰性关系可以正常工作。
我为spring配置了load-time-weaver:
<context:load-time-weaver weaver-
class="org.jboss.instrument.classloading.JBossLoadTimeWeaver" />
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter" ref="jpaAdapter" />
<property name="packagesToScan" value="com.ieci.mugeju.data.entity" />
<property name="mappingResources" value="titulares.xml" />
<property name="jpaProperties">
<props>
<prop key="eclipselink.logging.logger">ServerLogger</prop>
<prop key="eclipselink.logging.parameters">true</prop>
<prop key="eclipselink.logging.level.sql">FINE</prop>
<prop key="eclipselink.logging.level">ALL</prop>
<prop key="eclipselink.weaving">true</prop>
</props>
</property>
</bean>
为什么在定义jpa存储库后,懒惰的多对一关系不起作用?
谢谢