我尝试加载收藏到我的对象(我不能使用FetchType.EAGER),但我得到以下异常:加载延迟集合在@Transactional方法
org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: Produkt.opinie, could not initialize proxy - no Session
我不知道为什么,因为我在@Transactional范围内做:
@Service
@Transactional
public class ProduktService extends AbstractService implements IProduktService {
public Produkt findProduktById(Integer id) {
Produkt produkt = (Produkt) getSessionFactory().getCurrentSession()
.get(Produkt.class, id);
produkt.getOpinie();
return produkt;
}
}
,直至该层懒初始化应用程序配置支持? –