Full Stack Development with Spring Boot and React - darkchoco/spring-project GitHub Wiki
The codes I pushed here are based on Spring Boot 3 + PostgreSQL15.
The upcoming Spring Boot 3 is using Jakarta EE instead of Java EE. Therefore, you need to replace all javax
imports with jakarta
if you are using Spring Boot 3.
For example, javax.persistence.Entity
is replaced with jakarta.persistence.Entity
.
The table name 'user' is not allowed so I got an error as soon as the application was run. (like Syntax error in SQL statement "DROP TABLE IF EXISTS USER[*] CASCADE ";
...)
I solved just by renaming the Entity class name with SiteUser
, of course, there are other solutions available (using @Table
).
See https://stackoverflow.com/questions/70797504/spring-data-jpa-h2-database-is-returning-ddl-error-during-table-creation .
An error occurs if the column name is 'year' when using h2 database.
Just use the other name.
A strange error occurs 'Error creating bean with name 'entityManagerFactory'...' when I set the below line in src/test/resources/application.properties
(for testing).
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect
Actually, it has almost nothing to do with 'entityManagerFactory' stuff, but I used 'too old PostgreSQL dialect'.
It should be like below:
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQL94Dialect
Refer to https://docs.jboss.org/hibernate/orm/5.0/javadocs/org/hibernate/dialect/PostgreSQL94Dialect.html