Reputation:
When I am executing session.save(Object) Hibernate gives a many errors. I have posted this question on as many forums as possible
First error: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Table 'entity.listOfcases' doesn't exist
Then I also see one more error:
check the manual that corresponds to your MySQL server version for the right syntax to use near 'type=InnoDB' at line 1
I have used "update" and "create" both in my hibernate mapping file but still the table does not get automatically created in the database.
<property name="hibernate.hbm2ddl.auto">create</property>
<property name="hibernate.hbm2ddl.auto">update</property>
Used both of them above.
Third error: "org.hibernate.exception.SQLGrammarException: could not fetch initial value for increment generator"
I have checked all my getter setters and all the POJO classes. Everything is fine. When I create the tables manually everything works just great, its just that when I delete those tables and try to auto-create them, it doesn't work.
Upvotes: 0
Views: 1501
Reputation: 259
for me it worked when i updated the value from org.hibernate.dialect.MySQLDialect to org.hibernate.dialect.MySQL57Dialect
Upvotes: 1
Reputation: 5628
In your Hibernate mapping file i.e. hibernate.cfg.xml make the following change:
<property name="hibernate.dialect">org.hibernate.dialect.MySQL5InnoDBDialect</property>
instead of whatever it says right now. I am assuming:
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
This would definitely take care of all the errors if you say that you have checked rest of the code.
Upvotes: 0