Invalid Syntax Error "type=MyISAM" in DDL Generated by Hibernate
The "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'type = MyISAM' at line 1" error in DDL generated by Hibernate typically occurs due to a usage of the deprecated "type" attribute. Here's an analysis and solution:
Ursache
The "type" attribute in SQL is used to specify the storage engine for a table. In MySQL 4.x and earlier, it was common to use "type=MyISAM". However, this attribute was deprecated in MySQL 4.0 and removed in 5.5.
Lösung
To fix this issue, you need to use the correct dialect in your Hibernate configuration. Depending on your version of MariaDB and Hibernate, you need to use one of the following dialects:
MariaDB:
MySQL:
Beispiel
In your Hibernate configuration file, you can specify the correct dialect as follows:
<property name="hibernate.dialect">org.hibernate.dialect.MariaDBDialect</property>
Hinweis
With Hibernate 6, you should use MySQLDialect or MariaDBDialect, as these dialects will automatically configure themselves based on the connected database version.
以上是為什麼我在 Hibernate DDL 中遇到「type=MyISAM」語法錯誤?的詳細內容。更多資訊請關注PHP中文網其他相關文章!