JPA更新操作手写SQL 传入vo或者dto对象
作者:互联网
- 添加注解
- 开启原生sql,nativeQuery = true
/* 手写sql进行更新用户操作 */
@Modifying
@Transactional
@Query(nativeQuery = true,value = "update my_user set user_name=:#{#userInDto.userName},age=:#{#userInDto.age},email=:#{#userInDto.email},sex=:#{#userInDto.sex} where id=:#{#userInDto.id}")
int updateMyUser(@Param("userInDto") MyUserInDto userInDto);
标签:实体类,dto,JPA,Transactional,userInDto,vo,Param,sql,id 来源: https://www.cnblogs.com/leethomas/p/16455612.html