I am very new to spring JPA. I have following entity class which I want to insert in table:
@Entity
@Table(name = "test")
public class Test {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id")
private int id;
@Column(name = "user")
private String user;
}
I have an empty table named test. I have multiple objects of Test and I want to insert it to the table. For this I have created a repo class:
@Repository("testRepo")
public interface TestRepo extends JpaRepository<Test, String> {
//write insert query
@Modifying
@Query(//What insert query I should write)
void insertData(@Param("id") String id);
}
I have searched but getting only options for update query.