Reputation: 11
i'm creating a simple spring-boot application with mySql and Hibernate links. When i call some standard JpaRepository methods (for example findAll() ), Hibernate automatically creates a new table into my schema and consequently, my methods return empty list. I've tried to change my application.property, but the problem still remain.
application.properties:
> spring.datasource.url=jdbc:mysql://localhost:3306/carrello?&serverTimezone=UTC
> spring.datasource.username=root spring.datasource.password=root
> spring.jpa.show-sql=true hibernate.hbm2ddl.auto=none
Entity:
> @Entity
> @Table(name = "ARTICOLI", schema="carrello")
> public class Articolo {
>
> @Id
> @Column(name="ID_ARTICOLO")
> private int idArticolo;
>
> @Column(name="NOME_ARTICOLO")
> private String nomeArticolo;
>
> @Column(name="DESCRIZIONE_ARTICOLO")
> private String descrizioneArticolo;
>
> @Column(name="CATEGORIA_ARTICOLO")
> private String categoriaArticolo;
>
> @Column(name="PREZZO_ARTICOLO")
> private int prezzoArticolo;
>
> getters /setters
SQL:
> create table carrello.ARTICOLI (
> ID_ARTICOLO INT,
> NOME_ARTICOLO varchar(70),
> CATEGORIA_ARTICOLO varchar(50),
> DESCRIZIONE_ARTICOLO varchar (100),
> PREZZO_ARTICOLO int,
> primary key(ID_ARTICOLO)
> );
How can i disable this automatic table creation?
Upvotes: 0
Views: 1833