Rumah > Artikel > pangkalan data > Mengapa saya mendapat ralat sintaks "type=MyISAM" dalam DDL yang dijana Hibernate?
Invalid Syntax Error "type=MyISAM" in Hibernate-Generated DDL
In Java code, users may encounter the following syntax error:
Caused by :`com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException`: 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
This error arises when Hibernate generates a table creation query that includes the fragment "type = MyISAM." However, this syntax is deprecated in MySQL 4.0 and removed in 5.5.
Dialect Configuration
The problem stems from the use of the org.hibernate.dialect.MySQLDialect dialect, which is for MySQL 4.x or earlier. For MariaDB, it is recommended to use one of the following dialects, depending on the versions of MariaDB and Hibernate:
For MySQL, or if the MariaDB dialects are unavailable, consider using:
Hibernate 6 Dialects
With Hibernate 6, users should switch back to using MySQLDialect or MariaDBDialect as these dialects will configure themselves based on the actual connected version.
Atas ialah kandungan terperinci Mengapa saya mendapat ralat sintaks "type=MyISAM" dalam DDL yang dijana Hibernate?. Untuk maklumat lanjut, sila ikut artikel berkaitan lain di laman web China PHP!