创建对应的service
JpaService.java
package cn.wuyang.springboot.service;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import cn.wuyang.springboot.dao.JpaDao;
import cn.wuyang.springboot.entity.Jpa;
@Service
public class JpaService {
@Autowired
private JpaDao jpaDao;
//打开事务
@Transactional
public List<Jpa> jpaList(){
return jpaDao.findAll();
}
}
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/11256.html