org.springframework.orm.jpa.JpaSystemException: Session is closed!;

[color=red]错误信息:[/color]

org.springframework.orm.jpa.JpaSystemException: Session is closed!; nested exception is org.hibernate.SessionException: Session is closed!

[color=red]解决办法: [/color]

private EntityManager em;
@PersistenceContext ( unitName = "spring-jpa-creditaudit" )
public void SetEntityManager( EntityManager em ) {
this.em = em;
}

可能是当使用EntityManager时,对应调用的实现类没有加事物:
@Service
@Transactional(readOnly=true)
public class BankServiceImpl implements BankService {

}

你可能感兴趣的:(Java,Spring,Data,JPA)