小编Jos*_*ova的帖子

使用Spring Data和HIbernate JPA进行延迟加载

我正在使用SpringData和Hibernate执行一些测试,并在延迟加载和findBy ...方法上发现了一些有趣的行为.

我在子类上有以下方法.

列出findByArtistCredit(Long artistCreditId);

以及Recording和ArtistCredit之间的以下映射......

@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="artist_credit" , referencedColumnName="artist_credit_id")
private ArtistCredit artistCreditReference; 
Run Code Online (Sandbox Code Playgroud)

在"一"方面......

@OneToMany(fetch=FetchType.LAZY,mappedBy="artistCreditReference")
private Set<Recording> recordings; 
Run Code Online (Sandbox Code Playgroud)

而且会发生的事情是,"多方面"的收集正在急切地被提取......

有谁知道"为什么会这样?"

任何答案都很好.

问候.

java spring hibernate jpa spring-data-jpa

2
推荐指数
1
解决办法
872
查看次数

标签 统计

hibernate ×1

java ×1

jpa ×1

spring ×1

spring-data-jpa ×1