JPA操作数据库出现的一个bug

#这是今天遇到的一个JPA的bug

`org.springframework.orm.jpa.JpaSystemException: Could not set field
value [Route [rid=55, rname=【春节 海南三亚+蜈支洲岛 双飞4天 海口入三亚出/三亚入海口出
超贵团】独家安排游艇出海 升级1晚海边超豪华度假酒店, price=4399.0]] value by reflection :[class cn.itheima.travel.domain.RouteImg.rid] 
setter of cn.itheima.travel.domain.RouteImg.rid;

我们可以看到异常的产生原因是在访问数据库封装数据时出现的,我们去dao层查找原因;

IRouteImgDao extends JpaRepository<Route,Integer>,JpaSpecificationExecutor<Route>

好了,找到原因的所在了,我们在RouteImg层注入了Route对象,导致了一场,所以写代码以后一定要细心!

猜你喜欢

转载自blog.csdn.net/caiyibing1992/article/details/81665517