I am using mssql and spring data JPA, I want to insert new records to a table by using custom @Query annotation.
public interface CustomerRepository extends JpaRepository<Customers, String>{
@Modifying
@Query("insert into Customers values (?1 , ?2)")
public void saveCutomer(int custId, Customer cust);
}
Its giving error,
Caused by: org.hibernate.hql.internal.ast.QuerySyntaxException: expecting OPEN, found 'values' near line 1, column 23 [insert into Customers values (?1 , ?2)]
I tried below also, same error.
@Modifying
@Query("insert into Customers select ?1 , ?2")
public void saveCutomer(int custId, Customer cust);