on-internet
← Community

JPA insert query spring boot

Stack Overflow ·

I have class City which is: @Entity @Table(name="city",schema="rezervisi") public class City { @Id @GeneratedValue(strategy = GenerationType.IDENTITY) @Getter @Setter private int id; @Getter @Setter @NotBlank(message = "Name is mandatory") private String name; } Now I want to override save method in which I send object city. How can I do it if i want to send whole object and not @Params separately. And also since ID is generated how I handle it through parameter here? Code for repository class is: public interface CityRepo extends JpaRepository<City,Integer> { @Query(value="select id, name fro

Comments

Sign in or sign up to comment and upvote.

No comments yet.