Home > Database > Mysql Tutorial > body text

Why am I getting the 'type=MyISAM' syntax error in Hibernate-generated DDL?

Mary-Kate Olsen
Release: 2024-11-15 07:16:02
Original
307 people have browsed it

Why am I getting the

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
Copy after login

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:

  • org.hibernate.dialect.MariaDBDialect
  • org.hibernate.dialect.MariaDB53Dialect
  • org.hibernate.dialect.MariaDB106Dialect (or higher)

For MySQL, or if the MariaDB dialects are unavailable, consider using:

  • org.hibernate.dialect.MySQL5Dialect
  • org.hibernate.dialect.MySQL55Dialect
  • org.hibernate.dialect.MySQL57Dialect
  • org.hibernate.dialect.MySQL8Dialect
  • Variants of these dialects (e.g., org.hibernate.dialect.MySQL57InnoDBDialect)

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.

The above is the detailed content of Why am I getting the 'type=MyISAM' syntax error in Hibernate-generated DDL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template