2
I’m studying Spring with a little hibernate, where I stopped in a situation I can’t pass.
I configured the code with Hibernate for creating tables in the database but when I run the application it does not create.
My model class:
@Entity
@Table(name="cliente")
public class Cliente {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private int id;
private String nome;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
}
My properties:
server.port=${port:8080}
spring.datasource.url=jdbc:mysql://localhost:3306/clientesdb
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.username=root
spring.jpa.hibernate.ddl-auto = update
Mysql without password.
I’m doing something wrong?
I usually put
create=true;
in the url, see if it works this way:spring.datasource.url=jdbc:mysql://localhost:3306/clientesdb;create=true
besides you need to define the dialectspring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
– brow-joe