I am using the script of the spring.io/spring-roo/#running-from-shell fast guide, a 10 lines example.
The only modification is the jpa setup --provider
line, changed to connect PostgreSQL (HIBERNATE --database POSTGRES
). All the steps and code are at this roo_hello2pg.md
github document.
The application.properties seems
spring.datasource.driver-class-name=org.postgresql.Driver
spring.datasource.url=jdbc\:postgresql\://localhost\:5432/hello2bd
spring.datasource.username=postgres
spring.datasource.password=postgres
What more I need? Some spring.jpa.hibernate
lines? The browser generates error "status=500" when use database (insert a value).
As I could see in your gitHub repository, you have configured your connection to the Postgres database correctly.
But did you create the hello2db
database and the Timer
table in your system?
As the Spring Boot documentation sais, JPA databases will be automatically created only if you use an embedded database (H2, HSQL or Derby)
In your case, to create the database automatically using a Postgres DB, you should include the spring.jpa.hibernate.ddl-auto=create-drop
property in the application.properties
file.
Hope it helps,