首頁 >資料庫 >mysql教程 >為什麼我在 Hibernate 產生的 DDL 中收到'type=MyISAM”語法錯誤?

為什麼我在 Hibernate 產生的 DDL 中收到'type=MyISAM”語法錯誤?

Mary-Kate Olsen
Mary-Kate Olsen原創
2024-11-15 07:16:02431瀏覽

Why am I getting the

Hibernate 產生的DDL 中的無效語法錯誤「type=MyISAM」

在Java 程式碼中,使用者可能會遇到以下語法錯誤:

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

當Hibernate 產生包含片段的表建立查詢時,會出現此錯誤「類型=MyISAM。」但是,此語法在MySQL 4.0 中已棄用,並在5.5 中刪除。

方言配置

問題源自於 org.hibernate.dialect.MySQLDialect 方言的使用,適用於 MySQL 4.x 或更早版本。對於MariaDB,建議使用以下方言之一,取決於MariaDB 的版本和休眠:

  • org.hibernate.dialect.MariaDBDialect
  • org.hibernate.dialect.MariaDB53Dialect
  • org.hibernate.dialect.MariaDB53Dialect >
  • org.hibernate.dialect.MariaDB106Dialect(或更高)

對於MySQL,或如果MariaDB 方言不可用,請考慮使用:

  • org. hibernate.dialect.MySQL5Dialect
  • org.hibernate.dialect.MySQL55Dialect
  • org.hibernate.dialect.MySQL57Dialect
  • org.Patenate.變異體這些方言(例如org.hibernate.dialect.MySQL57InnoDBDialect)
Hibernate 6 方言

使用Hibernate 6 方言

使用Hibernate 6 方言使用Hibernate 6 方言使用Hibernate 6 方言使用Hibernate 6,使用者應切換使用MM因為這些方言將根據實際連接來配置自己版本。

以上是為什麼我在 Hibernate 產生的 DDL 中收到'type=MyISAM”語法錯誤?的詳細內容。更多資訊請關注PHP中文網其他相關文章!

陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn