Use jpa's getOne method to report errors

 PipelineVersionInfo info=pipelineVersionInfoDao.getOne(31);

Direct use will report the following error:

org.hibernate.LazyInitializationException: could not initialize proxy [com.xxx.bigdata.xxx.dto.mysql.xxxx#31] - no Session

Solution 1: Add @Transactional annotation to the
method. Method two can solve the problem, but it is not recommended.

Guess you like

Origin blog.csdn.net/qq_45106437/article/details/112801542