尝试从数据库中获取一些对象时,我不断收到错误消息:
org.hibernate.LazyInitializationException (LazyInitializationException.java:19) - could not initialize proxy - no Session
但我只在使用线程时得到错误。我们的应用结构方法调用流程如下:
FacadeImpl.saveRV() -->
@Transactional
@ParallelContext
BusinessImpl.validateEntry() -->
BusinessImpl.getOpMap() -->
@ParallelTask
DAOImpl.getMEFilter()
尝试访问获取的实体的字段时,我得到 LazyInitializationException,定义为:
// bi-directional many-to-one association to PtoConex
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "IDN_PTO_CONEX", insertable = false, updatable = false)
private PtoConex progTptoConex;
但是,如果我从和from@ParallelContext
的声明中删除注释,我没有任何问题。BusinessImpl.validateEntry()
@ParallelTask
DAOImpl.getMEFilter()