I continue using Spring Data JPA more and more. Maybe this question is a little more advanced...
I have a stored procedure in my Postgres database that is called to add a new record to table Car. It is an SP because it encapsulates additional data logic that must always be executed when adding records to this table.
How do I specify a method in my CarRepository interface that will call this SP? I tried with this:
This obviously does not work because what's inside the @Query annotation is native SQL and @Query expects JPA's query language (whatever it is called).
@Query("SELECT `Cars`.`CarAddMovement`(?1, ?2, ?3)")
void addMovement(Long instrument_id,
Can I somehow specify native SQL for one of my repository methods? Hopefully via an annotation?
Will I have to write an implementing class that will manually invoke the native SQL I have written above? Or can this somehow be magically delegated to Spring Data JPA?
Thanks in advance.