-2
When I go to execute I realize this mistake:
org.hibernate.tool.schema.spi.Commandacceptanceexception: Error executing DDL "create table tb-product (id int8 not null, name varchar(255), quantity Numeric(19, 2), value Numeric(19, 2), Primary key (id)" via JDBC Statement
Main Class
package com.produtos.apirest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
@EntityScan("com.produtos.apirest.models")
@SpringBootApplication
public class ApirestApplication {
public static void main(String[] args) {
SpringApplication.run(ApirestApplication.class, args);
}
}
Model
package com.produtos.apirest.models;
import java.io.Serializable;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
@Entity
@Table(name="TB-PRODUTO")
public class Produto implements Serializable{
private static final long serialVersionUID = 1L;
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
private long id;
private String nome;
private BigDecimal quantidade;
private BigDecimal valor;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public BigDecimal getQuantidade() {
return quantidade;
}
public void setQuantidade(BigDecimal quantidade) {
this.quantidade = quantidade;
}
public BigDecimal getValor() {
return valor;
}
public void setValor(BigDecimal valor) {
this.valor = valor;
}
}
Aplication properties
spring.jpa.properties.hibernate.jdbc.lob.non_contextual_creation=true
#Banco local - Luiz
spring.datasource.url= jdbc:postgresql://localhost:5432/produtos-apirest
spring.datasource.username=luiz
spring.datasource.password=123456
spring.jpa.hibernate.ddl-auto=update
That’s right, thank you very much!
– Luiz Nicolau Lemos Freitas
Show. Then accept the answer as correct. Vlw.
– Jean Merelis