JavaBeat Certifications Certifications Kits Articles Interview Questions OCAJP 7 OCPJP 5 OCPJP 6 OCEJWCD 6 SCBCD 5.0 SCEA SCJA

Hibernate JDBC and Connection Properties

Topic :
Feedback Request New QnA Print Email

Property namePurpose
hibernate.jdbc.fetch_size A non-zero value determines the JDBC fetch size (calls Statement.setFetchSize()).
hibernate.jdbc.batch_size A non-zero value enables use of JDBC2 batch updates by Hibernate.

eg. 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.

eg.true | false

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

eg.classname.of.Batcher

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.

eg.true | false

hibernate.jdbc.use_streams_for_binary Use streams when writing/reading binary or serializable types to/from JDBC (system-level property).

eg.true | false

hibernate.jdbc.use_get_generated_keys Enable 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, tries to determine the driver capabilites using connection metadata.

eg.true|false

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

eg.classname.of.ConnectionProvider

hibernate.connection.isolation Set the JDBC transaction isolation level. Check java.sql.Connection for meaningful values but note that most databases do not support all isolation levels.

eg.1, 2, 4, 8

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

eg.true | false

hibernate.connection.release_mode Specify 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, you should 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.

eg.auto (default) | on_close | after_transaction | after_statement

Note that this setting only affects Sessions returned from SessionFactory.openSession. For Sessions obtained through SessionFactory.getCurrentSession, the CurrentSessionContext implementation configured for use controls the connection release mode for those Sessions.

hibernate.connection.<propertyName> Pass the JDBC property propertyName to DriverManager.getConnection().
hibernate.jndi.<propertyName> Pass the property propertyName to the JNDI InitialContextFactory.

Topic :
Feedback Request New QnA Print Email

All api java java 6.0 java 7.0 jdbc jsp servlet ejb jndi jms ejb 3.0 j2ee jee 5.0 jee 6.0 jsf struts spring Hibernate ajax JBoss Seam netbeans eclipse ant xml maven dojo junit javafx j2me log4j ESB JBoss Apache Quartz scjp mysql oracle gwt openjpa jmx yui google-guice android JBoss scwcd 5.0 scjp 1.5 scjp 1.6 scja scbcd 5.0

javabeat | advertise | about us | contact | useful resources
Copyright (2004 - 2013), JavaBeat