I try to add the following code to a spring data jpa repository:
@Query(\"insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)\")
vo
I had to add nativeQuery = true
to @Query
@Query(value = "insert into commit_activity_link (commit_id, activity_id) VALUES (?1, ?2)", nativeQuery = true)
Use java object rather passing all parameters
@Modifying(clearAutomatically = true)
@Transactional
@Query(value = "insert into [xx_schema].[shipment_p] (gpn,qty,hscode,country_of_origin,created_date_time,shipment_id) "
+ "VALUES (:#{#sp.gpn},:#{#sp.qty}, :#{#sp.hscode} ,:#{#sp.countryOfOrigin}, :#{#sp.createdDateTime}, :#{#sp.id} )", nativeQuery = true)
public void saveShipmentPRoducts(@Param("sp") ShipmentProducts sp);