0

Is there a way to pass the whole sql statement or a part of it to @Query annotation?

@Modifying
@Query(value = "INSERT INTO my_table :query", nativeQuery = true)
@Transactional
void test(@Param("query") String query);
meridbt
  • 304
  • 1
  • 11

1 Answers1

1

I think a viable option for you would be to use the entity manager, instead of the repository. You can do it using NativeQuery and its executeUpdate method. Please check:

Inserting in my JPA using entity manager native query