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
Release: 2024-11-19 01:19:02
Original
1037 people have browsed it

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
    Copy after login
  • For MySQL versions 5.1 and above:

    hibernate.dialect=org.hibernate.dialect.MySQL5InnoDBDialect
    Copy after login

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!

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