Hibernate JDBC and Connection Properties

By: Felix Emailed: 1650 times Printed: 2122 times    

Latest comments
By: rohit kumar - how this program is work
By: Kirti - Hi..thx for the hadoop in
By: Spijker - I have altered the code a
By: ali mohammed - why we use the java in ne
By: ali mohammed - why we use the java in ne
By: mizhelle - when I exported the data
By: raul - no output as well, i'm ge
By: Rajesh - thanx very much...
By: Suindu De - Suppose we are executing

The table below lists the Hibernate JDBC and Connection Properties and their purpose. For easier understanding, and example is also provided for each property.
Property name Purpose
hibernate.jdbc.fetch_size A non-zero value determines the JDBC fetch size (callsStatement.setFetchSize()).
hibernate.jdbc.batch_size A non-zero value enables use of JDBC2 batch updates by Hibernate. 

e.g. recommended values between 5 and 30

hibernate.jdbc.batch_versioned_data Set this property to true if your JDBC driver returns correct row counts from executeBatch(). It is usually safe to turn this option on. Hibernate will then use batched DML for automatically versioned data. Defaults to false.

e.g. true | false

hibernate.jdbc.factory_class Select a custom org.hibernate.jdbc.Batcher. Most applications will not need this configuration property.

e.g. classname.of.BatcherFactory

hibernate.jdbc.use_scrollable_resultset Enables use of JDBC2 scrollable resultsets by Hibernate. This property is only necessary when using user-supplied JDBC connections. Hibernate uses connection metadata otherwise. 

e.g. true | false

hibernate.jdbc.use_streams_for_binary Use streams when writing/reading binary or serializabletypes to/from JDBC. *system-level property*

e.g. true | false

hibernate.jdbc.use_get_generated_keys Enables use of JDBC3 PreparedStatement.getGeneratedKeys()to retrieve natively generated keys after insert. Requires JDBC3+ driver and JRE1.4+, set to false if your driver has problems with the Hibernate identifier generators. By default, it tries to determine the driver capabilities using connection metadata.

e.g. true|false

hibernate.connection.provider_class The classname of a customorg.hibernate.connection.ConnectionProvider which provides JDBC connections to Hibernate.

e.g. classname.of.ConnectionProvider

hibernate.connection.isolation Sets the JDBC transaction isolation level. Checkjava.sql.Connection for meaningful values, but note that most databases do not support all isolation levels and some define additional, non-standard isolations.

e.g. 1, 2, 4, 8

hibernate.connection.autocommit Enables autocommit for JDBC pooled connections (it is not recommended). 

e.g. true | false

hibernate.connection.release_mode Specifies when Hibernate should release JDBC connections. By default, a JDBC connection is held until the session is explicitly closed or disconnected. For an application server JTA datasource, use after_statement to aggressively release connections after every JDBC call. For a non-JTA connection, it often makes sense to release the connection at the end of each transaction, by using after_transaction. auto will choose after_statement for the JTA and CMT transaction strategies and after_transaction for the JDBC transaction strategy.

e.g. auto (default) | on_close | after_transaction |after_statement

This setting only affects Sessions returned fromSessionFactory.openSession. For Sessions obtained throughSessionFactory.getCurrentSession, the CurrentSessionContextimplementation configured for use controls the connection release mode for those Sessions.

hibernate.connection.<propertyName> Pass the JDBC property <propertyName> toDriverManager.getConnection().
hibernate.jndi.<propertyName> Pass the property <propertyName> to the JNDIInitialContextFactory.

Hibernate Home | All Hibernate Tutorials | Latest Hibernate Tutorials

Sponsored Links

If this tutorial doesn't answer your question, or you have a specific question, just ask an expert here. Post your question to get a direct answer.



Bookmark and Share

Comments(0)


Be the first one to add a comment

Your name (required):


Your email(required, will not be shown to the public):


Your sites URL (optional):


Your comments:



More Tutorials by Felix
Hibernate JDBC and Connection Properties
Hibernate Transaction Properties
Hibernate Cache Properties
Hibernate Configuration Properties
Creating Connection Pool for JDBC Connections in Hibernate
SessionFactory in Hibernate
Programmatic configuration in Hibernate
Contextual sessions in Hibernate
Some Basic APIs in Hibernate
A sample Hibernate Web Application using Servlets
Step by Step Hibernate - Your First Hibernate Application
Tutorial Using the Java Persistence API (JPA) in Hibernate
Download Hibernate latest version

More Tutorials in Hibernate
Fetching strategies in Hibernate
equals() and hashCode() in Hibernate
Tuplizers (org.hibernate.tuple.Tuplizer) in Hibernate
EntityNameResolvers in Hibernate
Hi/lo algorithm in Hibernate
Identity columns and sequences in Hibernate
Assigned identifiers in Hibernate
Primary keys assigned by triggers in Hibernate
Formula in Hibernate
Step by Step Hibernate - Your First Hibernate Application
A sample Hibernate Web Application using Servlets
Some Basic APIs in Hibernate
Contextual sessions in Hibernate
Programmatic configuration in Hibernate
SessionFactory in Hibernate

More Latest News
Most Viewed Articles (in Hibernate )
Hibernate JDBC and Connection Properties
Fetching strategies in Hibernate
Hibernate Vs. JDBC ( A comparison)
equals() and hashCode() in Hibernate
Delta Electronics Chairman Bruce Cheng Endows NCKU Build Y.S. Sun Green Building Research Center
Step by Step Hibernate - Your First Hibernate Application
What is component mapping in hibernate?
Tutorial Using the Java Persistence API (JPA) in Hibernate
Hibernate Cache Properties
Tuplizers (org.hibernate.tuple.Tuplizer) in Hibernate
Assigned identifiers in Hibernate
Formula in Hibernate
Types of inheritence models in Hibernate
Paging Through the Result Set in Hibernate
Download Hibernate latest version
Most Emailed Articles (in Hibernate)
Some Basic APIs in Hibernate
Paging Through the Result Set in Hibernate
Hibernate Configuration Properties
Delta Electronics Chairman Bruce Cheng Endows NCKU Build Y.S. Sun Green Building Research Center
SessionFactory in Hibernate
Hibernate JDBC and Connection Properties
Assigned identifiers in Hibernate
What is component mapping in hibernate?
Download Hibernate latest version
Contextual sessions in Hibernate
Step by Step Hibernate - Your First Hibernate Application
Types of inheritence models in Hibernate
A sample Hibernate Web Application using Servlets
Programmatic configuration in Hibernate
Creating Connection Pool for JDBC Connections in Hibernate