Home >Database >Mysql Tutorial >How to Configure Hibernate to Create InnoDB Tables in MySQL?

How to Configure Hibernate to Create InnoDB Tables in MySQL?

Susan Sarandon
Susan SarandonOriginal
2024-11-19 01:19:021038browse

How to Configure Hibernate to Create InnoDB Tables in MySQL?

Modifying Hibernate Table Creation to Use InnoDB Instead of MyISAM

Question:

How can Hibernate, when used with JPA, be configured to create MySQL InnoDB tables?

Answer:

To specify the database dialect for Hibernate and force it to create InnoDB tables, you can use the following configurations:

  • For MySQL versions prior to 5.1:

    hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
  • For MySQL versions 5.1 and above:

    hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect

This approach allows you to modify the table creation process dynamically, without the need to generate separate SQL scripts.

The above is the detailed content of How to Configure Hibernate to Create InnoDB Tables in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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