Spring Boot - Hibernate - Table does not exists

Spring Boot - Hibernate - Table does not exists

Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'mydb.user' **doesn't exist**

I thing the issue with your program @EntityScan(basePackages = "com.third.party.entity.package") is incorrect where package not acceptable as a package name in java.

Else

Make sure your pojo entity user class is properly defined

@Entity
@Table(name = "User")
public class User implements Serializable {
    private static final long serialVersionUID = 1L;
    ...
    }

Try to add below line code in application.properties and run

application.properties

# Hibernate ddl auto (create, create-drop, update, none): with "update" the database
# schema will be automatically updated accordingly to java entities found in the project
spring.jpa.hibernate.ddl-auto = update

And exclude the Hibernate AutoConfiguration class in case it is there, by adding the Annotation below

@SpringBootApplication(exclude={HibernateJpaAutoConfiguration.class})

This question is similar to Hibernate says that table doesn't exist but it does


The real answer (for me) that may help someone is not to use an implicit naming strategy at all. If you just want to use what is annotated in the entity class, use a physical one like this:

spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl

Thanks to the @rsinha answer here:

Hibernate naming strategy changing table names