how to automatic create table in jpa persistence xml file?

前端 未结 2 2009
甜味超标
甜味超标 2020-12-07 03:08

I am using eclipse IDE.I also try following two .but failed..when i manually create table in my mysql database then my complete program run fine... I want create table autom

相关标签:
2条回答
  • 2020-12-07 03:48

    Dont use Hibernate specific options. JPA 2.1 provides

    javax.persistence.schema-generation.database.action
    

    that can be set to "create", "drop", "drop-and-create", "none". That way you keep your code JPA implementation independent

    0 讨论(0)
  • 2020-12-07 03:48

    Check your entity. Did you miss @Table annotation? The exception clearly says that the table is missing 'hibernate.employee':

    Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'hibernate.employee' doesn't exist at ...

    If you defined a naming strategy that prepends all tables with hibernate., then make sure that the tables are created in MySql.

    0 讨论(0)
提交回复
热议问题