SQL dialect
1. Hibernate JDBC Properties
Property name Purpose
Hibernate.connection.driver_class JDBC Driver class
Hibernate.connection.url JDBC URL
Hibernate.connection.username Database User
Hibernate.connection.password Database user Password
Maximum number of hibernate.connection.pool_size connection pool capacity
Note: Use C3P0 's properties sample code:
Hibernate.connection.driver_class = Org.postgresql.Driver
Hibernate.connection.url = Jdbc:postgresql://localhost/mydatabase
Hibernate.connection.username = MyUser
Hibernate.connection.password = Secret
Hibernate.c3p0.min_size=5
Hibernate.c3p0.max_size=20
hibernate.c3p0.timeout=1800
Hibernate.c3p0.max_statements=50
Hibernate.dialect = Org.hibernate.dialect.PostgreSQLDialect
2, Hibernate data Source properties
Property name Purpose
Hibernate.connection.datasource Data Source Jndi name
Hibernate.jndi.url the URL of the Jndi provider (optional)
Hibernate.jndi.class Jndi Initialcontextfactory class (optional)
Hibernate.connection.username database User (optional)
Hibernate.connection.password database user password (optional)
Note: Hibernate.properties sample code for an application server Jndi data source:
Hibernate.connection.datasource = Java:/comp/env/jdbc/test
Hibernate.transaction.factory_class =/
Org.hibernate.transaction.JTATransactionFactory
Hibernate.transaction.manager_lookup_class =/
Org.hibernate.transaction.JBossTransactionManagerLookup
Hibernate.dialect = Org.hibernate.dialect.PostgreSQLDialect
3. Hibernate configuration properties (optional)
Property name Purpose
Hibernate.dialect
A Hibernate dialect class name allows hibernate to generate optimized SQL for a particular relational database. Value Full.classname.of.Dialect
Hibernate.show_sql
Output all SQL statements to the console. Value TRUE | False
Hibernate.format_sql
Print more beautiful SQL in log and console. Value TRUE | False
Hibernate.default_schema
In the generated SQL, attach the given schema/tablespace to the table name of the unqualified name. Value Schema_name
Hibernate.default_catalog
In the generated SQL, attach the given catalog to the table name without the fully qualified name. Value Catalog_name
Hibernate.session_factory_name
When Sessionfactory is created, it is automatically bound to Jndi using this name. Value Jndi/composite/name
Hibernate.max_fetch_depth
Sets the maximum depth for the outer join fetch tree for one-way association (one-to-one, Many-to-many). A value of 0 means that the default outer connection crawl will be turned off. Value suggests a value between 0 and 3
Hibernate.default_batch_fetch_size
Sets the default number for the bulk crawl associated with the hibernate. Value recommended values are 4, 8, and 16
Hibernate.default_entity_mode
Specifies the default entity representation mode for all sessions opened by this sessionfactory. Value Dynamic-map, dom4j, Pojo
Hibernate.order_updates
Force hibernate to sort SQL updates according to the primary key of the data being updated. Doing so will reduce the deadlock in transactions in high concurrency systems. Value TRUE | False
Hibernate.generate_statistics
If turned on, hibernate collects statistics that will help with performance tuning. Value TRUE | False
Hibernate.use_identifer_rollback
If turned on, the identity property generated when the object is deleted will be reset to the default value. Value TRUE | False
Hibernate.use_sql_comments
If turned on, hibernate will generate annotation information in SQL that is useful for debugging, and the default value is False. Value TRUE | False
4. Hibernate jdbc and connection (connection) properties
Property name Purpose
Hibernate.jdbc.fetch_size
A value other than 0 that specifies the size of the JDBC crawl number (called Statement.setfetchsize ()).
Hibernate.jdbc.batch_size
A value other than 0, which allows Hibernate to use JDBC2 batch updates. Value suggests values from 5 to 30
Hibernate.jdbc.batch_versioned_data
If you want your JDBC driver to return the correct row count from ExecuteBatch (), set this property to True (this option is usually safe to turn on). Also, Hibernate will use batch DML for the automatically versioned data. Default value is False.eg.true | False
Hibernate.jdbc.factory_class
Select a custom Batcher. Most applications do not need this configuration attribute. Eg.classname.of.Batcher
Hibernate.jdbc.use_scrollable_resultset
Allows hibernate to use JDBC2 scrollable result sets. This option is necessary only if you are using a user-supplied JDBC connection, otherwise hibernate will use the concatenated metadata. Value TRUE | False
Hibernate.jdbc.use_streams_for_binary
Use Flow (stream) (System-level attributes) when JDBC reads and writes binary (binary) or serializable (serializable) types. Value TRUE | False
Hibernate.jdbc.use_get_generated_keys
After the data is inserted into the database, the JDBC3 Preparedstatement.getgeneratedkeys () is allowed to obtain the key (key) generated by the database. Requires jdbc3+ drive and jre1.4+, set this value to False if your database driver encounters problems using the Hibernate identity Builder. By default, the metadata of the connection is used to determine the drive capability. Value True|false
Hibernate.connection.provider_class
A custom ConnectionProvider class name that is used to provide a JDBC connection to the Hibernate. Value Classname.of.ConnectionProvider
Hibernate.connection.isolation
Set the JDBC transaction isolation level. Look at the java.sql.Connection to find out what each value means, but note that most databases do not support all isolation levels. Values 1, 2, 4, 8
Hibernate.connection.autocommit
Allow the cached JDBC connection to turn on Autocommit (autocommit) (not recommended). Value TRUE | False
Hibernate.connection.release_mode
Specifies when hibernate will release the JDBC connection. By default, a JDBC connection is released until the session is explicitly closed or disconnected. For the JTA data source of the application server, you should use after_statement so that the connection will be released voluntarily after each JDBC call. For a JTA connection, it is reasonable to use after_transaction to release the connection at the end of each transaction. Auto will select After_statement for the JTA and CMT transaction policy and select After_transaction for the JDBC transaction policy. Value On_close | after_transaction | after_statement | Auto
Hibernate.connection.<propertyname>
Pass the JDBC Property propertyname to Drivermanager.getconnection ().
Hibernate.jndi.<propertyname>
Passes the attribute PropertyName to the Jndi initialcontextfactory.
5, Hibernate cache Properties
Property name Purpose
Hibernate.cache.provider_class
The class name of the custom Cacheprovider. Value Classname.of.CacheProvider
Hibernate.cache.use_minimal_puts
Optimizes the level two cache to minimize write operations at the expense of frequent read operations. In Hibernate3, this setting is useful for cluster caching, which is enabled by default for the implementation of the cluster cache. Value True|false
Hibernate.cache.use_query_cache
Allows query caching, and individual queries still need to be set to cacheable. Value True|false
Hibernate.cache.use_second_level_cache
Can be used to completely prohibit the use of level two caching. For classes that specify <cache> in the mapping definition of a class, the level two cache is turned on by default. Value True|false
Hibernate.cache.query_cache_factory
A custom class name that implements the Querycache interface, which defaults to the built-in Standardquerycache. Value Classname.of.QueryCache
Hibernate.cache.region_prefix
Two-level buffer domain prefix. Value prefix
Hibernate.cache.use_structured_entries
Force hibernate to save data in a two-level cache in a more humane format. Value True|false
6, Hibernate transaction Properties
Property name Purpose
Hibernate.transaction.factory_class
A Transactionfactory class name for the Hibernate Transaction API (default is Jdbctransactionfactory). Value Classname.of.TransactionFactory
Jta. UserTransaction
A jndi name that is jtatransactionfactory used to obtain JTA usertransaction from the application server. Value Jndi/composite/name
Hibernate.transaction.manager_lookup_class
A Transactionmanagerlookup class name-This class is required when using JVM-level caching, or when using the Hilo generator in a JTA environment. Value Classname.of.TransactionManagerLookup
Hibernate.transaction.flush_before_completion
If turned on, session will be automatically cleaned after the transaction completes (flush). (Useful when Hibernate and CMT are used together.) Value TRUE | False
Hibernate.transaction.auto_close_session
If enabled, the session is automatically closed before the transaction completes. (Useful when Hibernate and CMT are used together.) Value TRUE | False
7, other properties
Property name Purpose
Hibernate.query.factory_class
Select the implementation of the HQL parser. Take the value org.hibernate.hql.ast.ASTQueryTranslatorFactory or Org.hibernate.hql.classic.ClassicQueryTranslatorFactory
Hibernate.query.substitutions
Maps a symbol in a hibernate query to a symbol in a SQL query (the symbol may be a function name or a constant name). Hqlliteral=sql_literal value, Hqlfunction=sqlfunc
Hibernate.hbm2ddl.auto
When Sessionfactory is created, the DDL for the database schema is automatically exported to the database. When Create-drop is used, the database schema is dropped when the sessionfactory is explicitly closed. Fetch Value Update | Create | Create-drop
Hibernate.cglib.use_reflection_optimizer
Turn on Cglib to replace the run-time reflection mechanism (System-level attributes). Reflection mechanisms are sometimes useful in debugging. Note that even if this optimization is turned off, hibernate still needs cglib. You cannot set this property in Hibernate.cfg.xml. Value TRUE | False
8. SQL dialect
Hibernate SQL dialect (hibernate.dialect)
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
9, Hibernate log category
Category Features
Org.hibernate.SQL logs log for all SQL DML statements when they are executed
Org.hibernate.type logging for all JDBC parameters
ORG.HIBERNATE.TOOL.HBM2DDL log records for all SQL DDL statements when they are executed
Org.hibernate.pretty the status log for all associated entities (up to 20) when session cleaning (flush)
Org.hibernate.cache Active log for all level two cache
Org.hibernate.transaction activity log for transaction-related
ORG.HIBERNATE.JDBC Log for all JDBC Resource acquisition logs
Org.hibernate.hql.ast for HQL and SQL automatic state transitions and other information logging for query resolution
Org.hibernate.secure Log for JAAS authentication requests
Org.hibernate for any hibernate related information to do a log (a large quantity, but it is very helpful for error checking)