I want to automatically drop the table and create a new one each time the application starts, and also automatically insert predefined data. I have already prepared the data in import.sql. I already installed spring.jpa.hibernate.ddl-auto=create-dropin application.properties. But why am I getting the following error? I can insert it simply by hand.
2015-11-20 20:53:57.242 ERROR 7092
2015-11-20 20:53:57.242 ERROR 7092
2015-11-20 20:53:57.242 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
2015-11-20 20:53:57.257 ERROR 7092
This is my essence:
@Entity
public class Gender {
@Id
@Column(name = "gender_id")
@GeneratedValue(strategy = GenerationType.IDENTITY)
private long id;
@Column(name = "gender_name")
private String name;
}
This is my request to import.sql:
INSERT INTO gender
(gender_id, gender_name)
VALUES
(1, 'Male'),
(2, 'Female');
source
share