Hibernate configuration Database dialect

Source: Internet
Author: User
Tags db2 microsoft sql server rollback sybase table definition

RDBMS dialect
DB2 Org.hibernate.dialect.DB2Dialect
DB2 as/400 Org.hibernate.dialect.DB2400Dialect
DB2 OS390 Org.hibernate.dialect.DB2390Dialect
PostgreSQL Org.hibernate.dialect.PostgreSQLDialect
Mysql Org.hibernate.dialect.MySQLDialect
MySQL with InnoDB Org.hibernate.dialect.MySQLInnoDBDialect
MySQL with MyISAM Org.hibernate.dialect.MySQLMyISAMDialect
Oracle (any version) Org.hibernate.dialect.OracleDialect
Oracle 9i/10g Org.hibernate.dialect.Oracle9Dialect
Sybase Org.hibernate.dialect.SybaseDialect
Sybase Anywhere Org.hibernate.dialect.SybaseAnywhereDialect
Microsoft SQL Server Org.hibernate.dialect.SQLServerDialect
SAP DB Org.hibernate.dialect.SAPDBDialect
Informix Org.hibernate.dialect.InformixDialect
Hypersonicsql Org.hibernate.dialect.HSQLDialect
Ingres Org.hibernate.dialect.IngresDialect
Progress Org.hibernate.dialect.ProgressDialect
Mckoi SQL Org.hibernate.dialect.MckoiDialect
Interbase Org.hibernate.dialect.InterbaseDialect
Pointbase Org.hibernate.dialect.PointbaseDialect
Frontbase Org.hibernate.dialect.FrontbaseDialect
Firebird Org.hibernate.dialect.FirebirdDialect


In the development of Hibernate program, need to do sessionfactory configuration, in short, that is to establish a connection with the database configuration, in Hibernate is generally used in the XML file configuration, However, in the configuration of the file you need to set the dialect dialect attribute value, for different databases, dialect value dialect is different, then the following lists how to set the dialect value in different databases (see the following table):


My first Hibernate program is a dialect problem:

MySQL with InnoDB Org.hibernate.dialect.MySQLInnoDBDialect

MySQL Org.hibernate.dialect.MySQLDialect



The difference between Mysqlinnodbdialect and Mysqlmyisamdialect

(Note: Mysqlinnodbdialect and mysqlmyisamdialect inherit from Mysqldialect.) )
InnoDB and MyISAM are two of the most important data storage engines for MySQL, both of which can be used to store tables and indexes, each with its pros and cons, depending on the application.

The basic differences are:

MyISAM types do not support advanced processing such as transaction processing, and InnoDB type support.

The MyISAM type of table emphasizes performance, which is performed more quickly than the InnoDB type, but does not provide transactional support, while InnoDB provides advanced database functionality such as transactional support and external keys.
InnoDB provides MySQL with transactional (commit), rollback (rollback), and crash-repair capabilities (crash recovery capabilities), multi-version concurrency control (multi-versioned concurrency Control) of the transaction security (Transaction-safe (ACID compliant)) type table. The InnoDB provides row-level locks (locking on row levels) that provide similar non-lock reads as Oracle (Non-locking read in selects). InnoDB locks the row-level and also provides an Oracle-style, non-locking read in the SELECT statement. In addition, the INNODB is designed for maximum performance when dealing with large amounts of data. Its CPU efficiency may be unmatched by any other disk-based relational database engine. Mysqlinnodbdialect is based on the same functionality as InnoDB.

The InnoDB storage engine is fully integrated with the MySQL server, and the InnoDB storage engine maintains its own buffer pool to cache data and indexes in main memory. InnoDB stores its table and index in a table space, a tablespace can contain several files (or raw disk partitions). This is different from the MyISAM table, such as in the MyISAM table where each table is in a separate file. The InnoDB table can be any size, even if the file size is limited to 2GB on the operating system.

InnoDB is transaction-safe. It has the same characteristics as the BDB type, and they also support foreign keys. The InnoDB table is fast. Has a richer feature than BDB, so it is recommended if you need a transaction-safe storage engine. If your data performs a large number of inserts or update, you should use the InnoDB table for performance reasons.
InnoDB up-to-date information can be found on http://www.innodb.com/. The latest version of the InnoDB manual is always placed there, and there is a InnoDB commercial license (order commercial licenses) as well as support available there.
MyISAM is the MySQL default storage engine. Each myisam is stored as three files on disk. The first file name begins with the name of the table, and the extension indicates the file type. frm file stores the table definition. The data file has an extension of. MYD (MYData). The extension of the index file is. MYI (Myindex).
MyISAM based on the traditional ISAM type, ISAM is an abbreviation for indexed sequential access method, which has indexed sequential access methods, which is the standard way to store records and files. Compared to other storage engines, MyISAM has most of the tools for checking and repairing tables. MyISAM tables can be compressed, and they support full-text search. They are not transaction-safe and do not support foreign keys. If the rollback of a thing causes incomplete rollback, it does not have atomicity. If executing a lot of select,myisam is a better choice.
Myiasm is a new version of the Iasm table, with the following extensions:
• Portability at the binary level.
· NULL column index.
• Less fragmentation of the variable-length line than the ISAM table.
• Support for large files.
• Better index compression.
• Better key-code statistical distributions.
• Better and faster auto_increment processing.
The following is a known difference between the two, for informational purposes only.
1.InnoDB does not support indexes of type Fulltext.
The exact number of rows in the table is not saved in 2.InnoDB, that is, when you execute select COUNT (*) from table, InnoDB scans the entire table to calculate how many rows, but MyISAM simply reads the saved rows. Note that when the COUNT (*) statement contains a where condition, the operation of the two tables is the same.
3. For a field of type auto_increment, InnoDB must contain only the index of that field, but in the MyISAM table, you can establish a federated index with other fields.
4.DELETE from table, InnoDB does not reestablish the table, but deletes one row at a time.
The 5.LOAD table from master operation has no effect on InnoDB, and the workaround is to first change the InnoDB table to a MyISAM table, import the data and then change it to a InnoDB table, but not for tables that use additional InnoDB features, such as foreign keys.
In addition, the row lock of the InnoDB table is not absolute, and if MySQL cannot determine the scope to scan when executing an SQL statement, the InnoDB table also locks the full table, such as the Update table set num=1 where name like "a%".
Any kind of table is not omnipotent, only appropriate for the business type to choose the appropriate table type, to maximize the performance advantage of MySQL.




Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.