1

I currently have hibernate.ddl set:

spring.jpa.hibernate.ddl-auto = create-drop 

I don't to lose my data again and again... What value I can use Instead of deleting and creating the schema every time Is there a way to update the existing one?
I was trying to use update in place of create-drop but it throws an exception:

 [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.3.3.RELEASE:run (default-cli) on project fno-connector-core: 
An exception occurred while running. null: InvocationTargetException: 
Failed to execute SQL script statement #1 of URL [file:/D:/..../classes/data.sql]: 
insert into users (username, enabled, password, first_name, last_name, email) 
values ('admin', true, '************', 'Flexera', 'Admin', 'aurovindosahu@*****.com'); 
nested exception is java.sql.SQLIntegrityConstraintViolationException: Duplicate entry 'admin' for key 'PRIMARY'

1 Answer 1

2

Possible values of spring.jpa.hibernate.ddl-auto are e.g. none | validate | update | create | create-drop. Reference

Make use of update in your usecase.

Sign up to request clarification or add additional context in comments.

2 Comments

First i am using create and after that If i use update then it throws exception
What is the exception? You can first drop the tables then re-run a fresh program with update.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.