[BAEL-2566] Add example of Insert with Modifying Native Query (#6164)
* [BAEL-2566] Add example of Insert with Modifying Native Query * [BAEL-2557] Fix MR conflicts * [BAEL-2557] Cleanup tests
This commit is contained in:
committed by
Josh Cummings
parent
96fbef6a14
commit
243c671edb
+5
-1
@@ -67,10 +67,14 @@ public interface UserRepository extends JpaRepository<User, Integer> , UserRepos
|
||||
@Query(value = "UPDATE Users u SET u.status = ? WHERE u.name = ?", nativeQuery = true)
|
||||
int updateUserSetStatusForNameNative(Integer status, String name);
|
||||
|
||||
@Query(value = "INSERT INTO Users (name, age, email, status) VALUES (:name, :age, :email, :status)", nativeQuery = true)
|
||||
@Modifying
|
||||
void insertUser(@Param("name") String name, @Param("age") Integer age, @Param("status") Integer status, @Param("email") String email);
|
||||
|
||||
@Modifying
|
||||
@Query(value = "UPDATE Users u SET status = ? WHERE u.name = ?", nativeQuery = true)
|
||||
int updateUserSetStatusForNameNativePostgres(Integer status, String name);
|
||||
|
||||
@Query(value = "SELECT u FROM User u WHERE u.name IN :names")
|
||||
List<User> findUserByNameList(@Param("names") Collection<String> names);
|
||||
List<User> findUserByNameList(@Param("names") Collection<String> names);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user