Hibernate SVN: r17958 - core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy.
by hibernate-commits@lists.jboss.org
Author: gbadner
Date: 2009-11-11 13:56:29 -0500 (Wed, 11 Nov 2009)
New Revision: 17958
Modified:
core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java
Log:
HHH-2762 : Add AbstractDelegateSessionImplementor.getNonFlushedChanges()/applyNonFlushedChanges()
Modified: core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java
===================================================================
--- core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java 2009-11-11 16:50:34 UTC (rev 17957)
+++ core/trunk/envers/src/main/java/org/hibernate/envers/entities/mapper/relation/lazy/AbstractDelegateSessionImplementor.java 2009-11-11 18:56:29 UTC (rev 17958)
@@ -45,6 +45,7 @@
import org.hibernate.engine.QueryParameters;
import org.hibernate.engine.SessionFactoryImplementor;
import org.hibernate.engine.SessionImplementor;
+import org.hibernate.engine.NonFlushedChanges;
import org.hibernate.engine.query.sql.NativeSQLQuerySpecification;
import org.hibernate.event.EventListeners;
import org.hibernate.impl.CriteriaImpl;
@@ -216,6 +217,14 @@
return delegate.executeNativeUpdate(specification, queryParameters);
}
+ public NonFlushedChanges getNonFlushedChanges() throws HibernateException {
+ return delegate.getNonFlushedChanges();
+ }
+
+ public void applyNonFlushedChanges(NonFlushedChanges nonFlushedChanges) throws HibernateException {
+ delegate.applyNonFlushedChanges( nonFlushedChanges );
+ }
+
public EntityMode getEntityMode() {
return delegate.getEntityMode();
}
15 years, 1 month
Hibernate SVN: r17957 - core/trunk/annotations.
by hibernate-commits@lists.jboss.org
Author: hardy.ferentschik
Date: 2009-11-11 11:50:34 -0500 (Wed, 11 Nov 2009)
New Revision: 17957
Modified:
core/trunk/annotations/pom.xml
Log:
HHH-4566 Added test scope to the jaxb dependencies
Modified: core/trunk/annotations/pom.xml
===================================================================
--- core/trunk/annotations/pom.xml 2009-11-11 16:30:22 UTC (rev 17956)
+++ core/trunk/annotations/pom.xml 2009-11-11 16:50:34 UTC (rev 17957)
@@ -146,11 +146,13 @@
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.1</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.1.3</version>
+ <scope>test</scope>
</dependency>
</dependencies>
</profile>
15 years, 1 month
Hibernate SVN: r17956 - core/trunk/parent.
by hibernate-commits@lists.jboss.org
Author: jcosta(a)redhat.com
Date: 2009-11-11 11:30:22 -0500 (Wed, 11 Nov 2009)
New Revision: 17956
Modified:
core/trunk/parent/pom.xml
Log:
HHH-4565 HSQLDB shouldn't be a dependency in compile scope
Modified: core/trunk/parent/pom.xml
===================================================================
--- core/trunk/parent/pom.xml 2009-11-11 05:58:42 UTC (rev 17955)
+++ core/trunk/parent/pom.xml 2009-11-11 16:30:22 UTC (rev 17956)
@@ -503,6 +503,7 @@
<groupId>hsqldb</groupId>
<artifactId>hsqldb</artifactId>
<version>1.8.0.2</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -530,6 +531,7 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.5</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -550,6 +552,7 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.0.5</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -570,6 +573,7 @@
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.8</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -590,6 +594,7 @@
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.2-504.jdbc3</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -610,6 +615,7 @@
<groupId>postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>8.2-504.jdbc3</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -636,6 +642,7 @@
<groupId>com.ibm</groupId>
<artifactId>db2jcc</artifactId>
<version>3.1.57</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
@@ -661,6 +668,7 @@
<groupId>com.ibm</groupId>
<artifactId>db2jcc</artifactId>
<version>3.8.47</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
@@ -686,6 +694,7 @@
<groupId>com.ibm</groupId>
<artifactId>db2jcc</artifactId>
<version>3.57.86</version>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>com.ibm</groupId>
@@ -712,6 +721,7 @@
<artifactId>ojdbc14</artifactId>
<!-- use the 10g drivers which are surprisingly largely bug free -->
<version>10.0.2.0</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -733,6 +743,7 @@
<artifactId>ojdbc14</artifactId>
<!-- use the 10g drivers which are surprisingly largely bug free -->
<version>10.0.2.0</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -753,6 +764,7 @@
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.1.0.7.0</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -773,6 +785,7 @@
<groupId>com.oracle</groupId>
<artifactId>ojdbc5</artifactId>
<version>11.1.0.7.0</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -793,6 +806,7 @@
<groupId>com.sybase</groupId>
<artifactId>jconnect</artifactId>
<version>6.0.5</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -812,7 +826,8 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>msjdbc</artifactId>
- <version>1.1</version>
+ <version>2.0.1008.2</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
@@ -832,7 +847,8 @@
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>msjdbc</artifactId>
- <version>1.1</version>
+ <version>2.0.1008.2</version>
+ <scope>test</scope>
</dependency>
</dependencies>
<properties>
15 years, 1 month
Hibernate SVN: r17955 - in core/trunk/core/src/main/java/org/hibernate: jdbc and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-11-11 00:58:42 -0500 (Wed, 11 Nov 2009)
New Revision: 17955
Modified:
core/trunk/core/src/main/java/org/hibernate/engine/transaction/Isolater.java
core/trunk/core/src/main/java/org/hibernate/jdbc/Batcher.java
Log:
HHH-4561 - Deprecate openConnection()/closeConnection() methods on Batcher interface
Modified: core/trunk/core/src/main/java/org/hibernate/engine/transaction/Isolater.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/transaction/Isolater.java 2009-11-11 05:58:21 UTC (rev 17954)
+++ core/trunk/core/src/main/java/org/hibernate/engine/transaction/Isolater.java 2009-11-11 05:58:42 UTC (rev 17955)
@@ -28,12 +28,15 @@
import java.sql.SQLException;
import javax.transaction.Transaction;
import javax.transaction.TransactionManager;
+import javax.transaction.SystemException;
+import javax.transaction.NotSupportedException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.hibernate.HibernateException;
import org.hibernate.engine.SessionImplementor;
import org.hibernate.exception.JDBCExceptionHelper;
+import org.hibernate.exception.SQLExceptionConverter;
/**
* Class which provides the isolation semantics required by
@@ -108,80 +111,116 @@
public void delegateWork(IsolatedWork work, boolean transacted) throws HibernateException {
TransactionManager transactionManager = session.getFactory().getTransactionManager();
- Transaction surroundingTransaction = null;
- Connection connection = null;
- boolean caughtException = false;
try {
- // First we need to suspend any current JTA transaction and obtain
- // a JDBC connection
- surroundingTransaction = transactionManager.suspend();
+ // First we suspend any current JTA transaction
+ Transaction surroundingTransaction = transactionManager.suspend();
if ( log.isDebugEnabled() ) {
log.debug( "surrounding JTA transaction suspended [" + surroundingTransaction + "]" );
}
- if ( transacted ) {
- transactionManager.begin();
+ boolean hadProblems = false;
+ try {
+ // then peform the requested work
+ if ( transacted ) {
+ doTheWorkInNewTransaction( work, transactionManager );
+ }
+ else {
+ doTheWorkInNoTransaction( work );
+ }
}
+ catch ( HibernateException e ) {
+ hadProblems = true;
+ throw e;
+ }
+ finally {
+ try {
+ transactionManager.resume( surroundingTransaction );
+ if ( log.isDebugEnabled() ) {
+ log.debug( "surrounding JTA transaction resumed [" + surroundingTransaction + "]" );
+ }
+ }
+ catch( Throwable t ) {
+ // if the actually work had an error use that, otherwise error based on t
+ if ( !hadProblems ) {
+ //noinspection ThrowFromFinallyBlock
+ throw new HibernateException( "Unable to resume previously suspended transaction", t );
+ }
+ }
+ }
+ }
+ catch ( SystemException e ) {
+ throw new HibernateException( "Unable to suspend current JTA transaction", e );
+ }
+ }
- connection = session.getBatcher().openConnection();
+ private void doTheWorkInNewTransaction(IsolatedWork work, TransactionManager transactionManager) {
+ try {
+ // start the new isolated transaction
+ transactionManager.begin();
- // doAfterTransactionCompletion the actual work
- work.doWork( connection );
-
- // if everything went ok, commit the transaction and close the obtained
- // connection handle...
- session.getBatcher().closeConnection( connection );
-
- if ( transacted ) {
+ try {
+ doTheWork( work );
+ // if everythign went ok, commit the isolated transaction
transactionManager.commit();
}
- }
- catch( Throwable t ) {
- // at some point the processing went bad, so we need to:
- // 1) make sure the connection handle gets released
- // 2) try to cleanup the JTA context as much as possible
- caughtException = true;
- try {
- if ( connection != null && !connection.isClosed() ) {
- session.getBatcher().closeConnection( connection );
- }
- }
- catch( Throwable ignore ) {
- log.trace( "unable to release connection on exception [" + ignore + "]" );
- }
- if ( transacted ) {
+ catch ( Exception e ) {
try {
transactionManager.rollback();
}
- catch( Throwable ignore ) {
- log.trace( "unable to rollback new transaction on exception [" + ignore + "]" );
+ catch ( Exception ignore ) {
+ log.info( "Unable to rollback isolated transaction on error [" + e + "] : [" + ignore + "]" );
}
}
- // finally handle the exception
- if ( t instanceof HibernateException ) {
- throw ( HibernateException ) t;
+ }
+ catch ( SystemException e ) {
+ throw new HibernateException( "Unable to start isolated transaction", e );
+ }
+ catch ( NotSupportedException e ) {
+ throw new HibernateException( "Unable to start isolated transaction", e );
+ }
+ }
+
+ private void doTheWorkInNoTransaction(IsolatedWork work) {
+ doTheWork( work );
+ }
+
+ private void doTheWork(IsolatedWork work) {
+ try {
+ // obtain our isolated connection
+ Connection connection = session.getFactory().getConnectionProvider().getConnection();
+ try {
+ // do the actual work
+ work.doWork( connection );
}
- else {
- throw new HibernateException( "error performing isolated work", t );
+ catch ( HibernateException e ) {
+ throw e;
}
- }
- finally {
- if ( surroundingTransaction != null ) {
+ catch ( Exception e ) {
+ throw new HibernateException( "Unable to perform isolated work", e );
+ }
+ finally {
try {
- transactionManager.resume( surroundingTransaction );
- if ( log.isDebugEnabled() ) {
- log.debug( "surrounding JTA transaction resumed [" + surroundingTransaction + "]" );
- }
+ // no matter what, release the connection (handle)
+ session.getFactory().getConnectionProvider().closeConnection( connection );
}
- catch( Throwable t ) {
- if ( !caughtException ) {
- throw new HibernateException( "unable to resume previously suspended transaction", t );
- }
+ catch ( Throwable ignore ) {
+ log.info( "Unable to release isolated connection [" + ignore + "]" );
}
}
}
+ catch ( SQLException sqle ) {
+ throw JDBCExceptionHelper.convert(
+ sqlExceptionConverter(),
+ sqle,
+ "unable to obtain isolated JDBC connection"
+ );
+ }
}
+
+ private SQLExceptionConverter sqlExceptionConverter() {
+ return session.getFactory().getSQLExceptionConverter();
+ }
}
/**
@@ -196,61 +235,75 @@
}
public void delegateWork(IsolatedWork work, boolean transacted) throws HibernateException {
- Connection connection = null;
boolean wasAutoCommit = false;
try {
- connection = session.getBatcher().openConnection();
-
- if ( transacted ) {
- if ( connection.getAutoCommit() ) {
- wasAutoCommit = true;
- connection.setAutoCommit( false );
+ Connection connection = session.getFactory().getConnectionProvider().getConnection();
+ try {
+ if ( transacted ) {
+ if ( connection.getAutoCommit() ) {
+ wasAutoCommit = true;
+ connection.setAutoCommit( false );
+ }
}
- }
- work.doWork( connection );
+ work.doWork( connection );
- if ( transacted ) {
- connection.commit();
+ if ( transacted ) {
+ connection.commit();
+ }
}
- }
- catch( Throwable t ) {
- try {
- if ( transacted && connection != null && !connection.isClosed() ) {
- connection.rollback();
+ catch( Exception e ) {
+ try {
+ if ( transacted && !connection.isClosed() ) {
+ connection.rollback();
+ }
}
- }
- catch( Throwable ignore ) {
- log.trace( "unable to release connection on exception [" + ignore + "]" );
- }
+ catch( Exception ignore ) {
+ log.info( "unable to rollback connection on exception [" + ignore + "]" );
+ }
- if ( t instanceof HibernateException ) {
- throw ( HibernateException ) t;
+ if ( e instanceof HibernateException ) {
+ throw ( HibernateException ) e;
+ }
+ else if ( e instanceof SQLException ) {
+ throw JDBCExceptionHelper.convert(
+ sqlExceptionConverter(),
+ ( SQLException ) e,
+ "error performing isolated work"
+ );
+ }
+ else {
+ throw new HibernateException( "error performing isolated work", e );
+ }
}
- else if ( t instanceof SQLException ) {
- throw JDBCExceptionHelper.convert(
- session.getFactory().getSQLExceptionConverter(),
- ( SQLException ) t,
- "error performing isolated work"
- );
- }
- else {
- throw new HibernateException( "error performing isolated work", t );
- }
- }
- finally {
- if ( connection != null ) {
+ finally {
if ( transacted && wasAutoCommit ) {
try {
connection.setAutoCommit( true );
}
- catch( Throwable ignore ) {
+ catch( Exception ignore ) {
log.trace( "was unable to reset connection back to auto-commit" );
}
}
- session.getBatcher().closeConnection( connection );
+ try {
+ session.getFactory().getConnectionProvider().closeConnection( connection );
+ }
+ catch ( Exception ignore ) {
+ log.info( "Unable to release isolated connection [" + ignore + "]" );
+ }
}
}
+ catch ( SQLException sqle ) {
+ throw JDBCExceptionHelper.convert(
+ sqlExceptionConverter(),
+ sqle,
+ "unable to obtain isolated JDBC connection"
+ );
+ }
}
+
+ private SQLExceptionConverter sqlExceptionConverter() {
+ return session.getFactory().getSQLExceptionConverter();
+ }
}
}
Modified: core/trunk/core/src/main/java/org/hibernate/jdbc/Batcher.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/jdbc/Batcher.java 2009-11-11 05:58:21 UTC (rev 17954)
+++ core/trunk/core/src/main/java/org/hibernate/jdbc/Batcher.java 2009-11-11 05:58:42 UTC (rev 17955)
@@ -165,10 +165,14 @@
/**
* Obtain a JDBC connection
+ *
+ * @deprecated Obtain connections from {@link ConnectionProvider} instead
*/
public Connection openConnection() throws HibernateException;
/**
* Dispose of the JDBC connection
+ *
+ * @deprecated Obtain connections from {@link ConnectionProvider} instead
*/
public void closeConnection(Connection conn) throws HibernateException;
15 years, 1 month
Hibernate SVN: r17954 - in core/branches/Branch_3_3/core/src/main/java/org/hibernate: jdbc and 1 other directory.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-11-11 00:58:21 -0500 (Wed, 11 Nov 2009)
New Revision: 17954
Modified:
core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java
core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java
Log:
HHH-4561 - Deprecate openConnection()/closeConnection() methods on Batcher interface
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java 2009-11-10 21:59:05 UTC (rev 17953)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/engine/transaction/Isolater.java 2009-11-11 05:58:21 UTC (rev 17954)
@@ -124,14 +124,14 @@
transactionManager.begin();
}
- connection = session.getBatcher().openConnection();
+ connection = session.getFactory().getConnectionProvider().getConnection();
// perform the actual work
work.doWork( connection );
// if everything went ok, commit the transaction and close the obtained
// connection handle...
- session.getBatcher().closeConnection( connection );
+ session.getFactory().getConnectionProvider().closeConnection( connection );
if ( transacted ) {
transactionManager.commit();
@@ -144,7 +144,7 @@
caughtException = true;
try {
if ( connection != null && !connection.isClosed() ) {
- session.getBatcher().closeConnection( connection );
+ session.getFactory().getConnectionProvider().closeConnection( connection );
}
}
catch( Throwable ignore ) {
@@ -176,6 +176,7 @@
}
catch( Throwable t ) {
if ( !caughtException ) {
+ //noinspection ThrowFromFinallyBlock
throw new HibernateException( "unable to resume previously suspended transaction", t );
}
}
@@ -199,7 +200,7 @@
Connection connection = null;
boolean wasAutoCommit = false;
try {
- connection = session.getBatcher().openConnection();
+ connection = session.getFactory().getConnectionProvider().getConnection();
if ( transacted ) {
if ( connection.getAutoCommit() ) {
@@ -248,7 +249,12 @@
log.trace( "was unable to reset connection back to auto-commit" );
}
}
- session.getBatcher().closeConnection( connection );
+ try {
+ session.getFactory().getConnectionProvider().closeConnection( connection );
+ }
+ catch ( Exception ignore ) {
+ log.info( "Unable to release isolated connection [" + ignore + "]" );
+ }
}
}
}
Modified: core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java
===================================================================
--- core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java 2009-11-10 21:59:05 UTC (rev 17953)
+++ core/branches/Branch_3_3/core/src/main/java/org/hibernate/jdbc/Batcher.java 2009-11-11 05:58:21 UTC (rev 17954)
@@ -165,10 +165,14 @@
/**
* Obtain a JDBC connection
+ *
+ * @deprecated Obtain connections from {@link ConnectionProvider} instead
*/
public Connection openConnection() throws HibernateException;
/**
* Dispose of the JDBC connection
+ *
+ * @deprecated Obtain connections from {@link ConnectionProvider} instead
*/
public void closeConnection(Connection conn) throws HibernateException;
15 years, 1 month
Hibernate SVN: r17953 - core/branches/Branch_3_3/core.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-11-10 16:59:05 -0500 (Tue, 10 Nov 2009)
New Revision: 17953
Modified:
core/branches/Branch_3_3/core/pom.xml
Log:
HHH-4548 - Alter poms to not use javax.* artifacts under Sun proprietary license
Modified: core/branches/Branch_3_3/core/pom.xml
===================================================================
--- core/branches/Branch_3_3/core/pom.xml 2009-11-10 21:27:01 UTC (rev 17952)
+++ core/branches/Branch_3_3/core/pom.xml 2009-11-10 21:59:05 UTC (rev 17953)
@@ -44,33 +44,19 @@
<dependency>
<!-- YUCK, YUCK, YUCK!!!! -->
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-transaction-api</artifactId>
- <version>1.0.1.GA</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
</dependency>
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jacc-api</artifactId>
- <version>1.1.0.GA</version>
+ <version>1.1.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api</artifactId>
+ <groupId>jboss.web</groupId>
+ <artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.logging</groupId>
15 years, 1 month
Hibernate SVN: r17952 - core/trunk/core.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-11-10 16:27:01 -0500 (Tue, 10 Nov 2009)
New Revision: 17952
Modified:
core/trunk/core/pom.xml
Log:
HHH-4548 - Alter poms to not use javax.* artifacts under Sun proprietary license
Modified: core/trunk/core/pom.xml
===================================================================
--- core/trunk/core/pom.xml 2009-11-10 21:26:50 UTC (rev 17951)
+++ core/trunk/core/pom.xml 2009-11-10 21:27:01 UTC (rev 17952)
@@ -44,33 +44,19 @@
<dependency>
<!-- YUCK, YUCK, YUCK!!!! -->
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-transaction-api</artifactId>
- <version>1.0.1.GA</version>
- <exclusions>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging-spi</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss</groupId>
- <artifactId>jboss-common-core</artifactId>
- </exclusion>
- </exclusions>
+ <groupId>javax.transaction</groupId>
+ <artifactId>jta</artifactId>
+ <version>1.1</version>
</dependency>
<dependency>
<groupId>org.jboss.javaee</groupId>
<artifactId>jboss-jacc-api</artifactId>
- <version>1.1.0.GA</version>
+ <version>1.1.1-SNAPSHOT</version>
<scope>provided</scope>
<exclusions>
<exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-servlet-api</artifactId>
+ <groupId>jboss.web</groupId>
+ <artifactId>servlet-api</artifactId>
</exclusion>
<exclusion>
<groupId>org.jboss.logging</groupId>
15 years, 1 month
Hibernate SVN: r17951 - core/trunk/core/src/main/java/org/hibernate/engine/jdbc.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-11-10 16:26:50 -0500 (Tue, 10 Nov 2009)
New Revision: 17951
Modified:
core/trunk/core/src/main/java/org/hibernate/engine/jdbc/ContextualLobCreator.java
Log:
HHH-4560 - JDBC4 support inadvertently missed 1.4 compatibility
Modified: core/trunk/core/src/main/java/org/hibernate/engine/jdbc/ContextualLobCreator.java
===================================================================
--- core/trunk/core/src/main/java/org/hibernate/engine/jdbc/ContextualLobCreator.java 2009-11-10 20:00:14 UTC (rev 17950)
+++ core/trunk/core/src/main/java/org/hibernate/engine/jdbc/ContextualLobCreator.java 2009-11-10 21:26:50 UTC (rev 17951)
@@ -36,6 +36,7 @@
import java.lang.reflect.InvocationTargetException;
import org.hibernate.HibernateException;
+import org.hibernate.JDBCException;
/**
* {@link LobCreator} implementation using contextual creation against the JDBC {@link java.sql.Connection} class's LOB creation
@@ -70,7 +71,7 @@
return blob;
}
catch ( SQLException e ) {
- throw new IllegalStateException( "Unable to set BLOB bytes after creation", e );
+ throw new JDBCException( "Unable to set BLOB bytes after creation", e );
}
}
@@ -88,10 +89,10 @@
return blob;
}
catch ( SQLException e ) {
- throw new IllegalStateException( "Unable to prepare BLOB binary stream for writing", e );
+ throw new JDBCException( "Unable to prepare BLOB binary stream for writing",e );
}
catch ( IOException e ) {
- throw new IllegalStateException( "Unable to write stream contents to BLOB", e );
+ throw new HibernateException( "Unable to write stream contents to BLOB", e );
}
}
@@ -114,7 +115,7 @@
return clob;
}
catch ( SQLException e ) {
- throw new IllegalStateException( "Unable to set CLOB string after creation", e );
+ throw new JDBCException( "Unable to set CLOB string after creation", e );
}
}
@@ -131,10 +132,10 @@
return clob;
}
catch ( SQLException e ) {
- throw new IllegalStateException( "Unable to prepare CLOB stream for writing", e );
+ throw new JDBCException( "Unable to prepare CLOB stream for writing", e );
}
catch ( IOException e ) {
- throw new IllegalStateException( "Unable to write CLOB stream content", e );
+ throw new HibernateException( "Unable to write CLOB stream content", e );
}
}
@@ -157,7 +158,7 @@
return clob;
}
catch ( SQLException e ) {
- throw new IllegalStateException( "Unable to set NCLOB string after creation", e );
+ throw new JDBCException( "Unable to set NCLOB string after creation", e );
}
}
@@ -174,10 +175,10 @@
return clob;
}
catch ( SQLException e ) {
- throw new IllegalStateException( "Unable to prepare NCLOB stream for writing", e );
+ throw new JDBCException( "Unable to prepare NCLOB stream for writing", e );
}
catch ( IOException e ) {
- throw new IllegalStateException( "Unable to write NCLOB stream content", e );
+ throw new HibernateException( "Unable to write NCLOB stream content", e );
}
}
@@ -216,11 +217,11 @@
}
catch ( AbstractMethodError e ) {
// this again is a big big error...
- throw new IllegalStateException( "Useable implementation of " + creationMethod.getName() + " not found.", e );
+ throw new IllegalStateException( "Useable implementation of " + creationMethod.getName() + " not found." );
}
catch ( IllegalAccessException e ) {
// this again is a big big error...
- throw new IllegalStateException( "Illegal access attempt on JDBC method " + creationMethod.getName(), e );
+ throw new IllegalStateException( "Illegal access attempt on JDBC method " + creationMethod.getName() );
}
}
}
@@ -231,7 +232,7 @@
}
catch ( NoSuchMethodException e ) {
// this is a big big error if we get here and these methods are not part of the Connection interface...
- throw new IllegalStateException( "JDBC driver did not implement " + methodName, e );
+ throw new IllegalStateException( "JDBC driver did not implement " + methodName);
}
}
}
15 years, 1 month
Hibernate SVN: r17950 - core/trunk/documentation/manual/src/main/docbook/en-US/content.
by hibernate-commits@lists.jboss.org
Author: steve.ebersole(a)jboss.com
Date: 2009-11-10 15:00:14 -0500 (Tue, 10 Nov 2009)
New Revision: 17950
Modified:
core/trunk/documentation/manual/src/main/docbook/en-US/content/performance.xml
Log:
HHH-4550 - Document that update-timestamps cache region should not be configured for expiry.
Modified: core/trunk/documentation/manual/src/main/docbook/en-US/content/performance.xml
===================================================================
--- core/trunk/documentation/manual/src/main/docbook/en-US/content/performance.xml 2009-11-10 18:17:46 UTC (rev 17949)
+++ core/trunk/documentation/manual/src/main/docbook/en-US/content/performance.xml 2009-11-10 20:00:14 UTC (rev 17950)
@@ -767,21 +767,21 @@
<entry>Hashtable (not intended for production use)</entry>
<entry><literal>org.hibernate.cache.HashtableCacheProvider</literal></entry>
<entry>memory</entry>
- <entry></entry>
+ <entry> </entry>
<entry>yes</entry>
</row>
<row>
<entry>EHCache</entry>
<entry><literal>org.hibernate.cache.EhCacheProvider</literal></entry>
<entry>memory, disk</entry>
- <entry></entry>
+ <entry> </entry>
<entry>yes</entry>
</row>
<row>
<entry>OSCache</entry>
<entry><literal>org.hibernate.cache.OSCacheProvider</literal></entry>
<entry>memory, disk</entry>
- <entry></entry>
+ <entry> </entry>
<entry>yes</entry>
</row>
<row>
@@ -789,7 +789,7 @@
<entry><literal>org.hibernate.cache.SwarmCacheProvider</literal></entry>
<entry>clustered (ip multicast)</entry>
<entry>yes (clustered invalidation)</entry>
- <entry></entry>
+ <entry> </entry>
</row>
<row>
<entry>JBoss Cache 1.x</entry>
@@ -970,41 +970,41 @@
<entry>yes</entry>
<entry>yes</entry>
<entry>yes</entry>
- <entry></entry>
+ <entry> </entry>
</row>
<row>
<entry>EHCache</entry>
<entry>yes</entry>
<entry>yes</entry>
<entry>yes</entry>
- <entry></entry>
+ <entry> </entry>
</row>
<row>
<entry>OSCache</entry>
<entry>yes</entry>
<entry>yes</entry>
<entry>yes</entry>
- <entry></entry>
+ <entry> </entry>
</row>
<row>
<entry>SwarmCache</entry>
<entry>yes</entry>
<entry>yes</entry>
- <entry></entry>
- <entry></entry>
+ <entry> </entry>
+ <entry> </entry>
</row>
<row>
<entry>JBoss Cache 1.x</entry>
<entry>yes</entry>
- <entry></entry>
- <entry></entry>
+ <entry> </entry>
+ <entry> </entry>
<entry>yes</entry>
</row>
<row>
<entry>JBoss Cache 2</entry>
<entry>yes</entry>
- <entry></entry>
- <entry></entry>
+ <entry> </entry>
+ <entry> </entry>
<entry>yes</entry>
</row>
</tbody>
@@ -1110,56 +1110,98 @@
hibernate.cache.use_structured_entries true]]></programlisting>
</sect1>
-
+
<sect1 id="performance-querycache" revision="1">
<title>The Query Cache</title>
<para>
Query result sets can also be cached. This is only useful for queries that are run
- frequently with the same parameters. You will first need to enable the query cache:
+ frequently with the same parameters.
</para>
- <programlisting><![CDATA[hibernate.cache.use_query_cache true]]></programlisting>
-
- <para>
- This setting creates two new cache regions: one holding cached query
- result sets (<literal>org.hibernate.cache.StandardQueryCache</literal>), the other
- holding timestamps of the most recent updates to queryable tables
- (<literal>org.hibernate.cache.UpdateTimestampsCache</literal>). Note that the query
- cache does not cache the state of the actual entities in the result set; it caches
- only identifier values and results of value type. The query cache should always be
- used in conjunction with the second-level cache.
- </para>
-
- <para>
- Most queries do not benefit from caching, so by default, queries are not cached. To
- enable caching, call <literal>Query.setCacheable(true)</literal>. This call allows
- the query to look for existing cache results or add its results to the cache when
- it is executed.
- </para>
-
- <para>
- If you require fine-grained control over query cache expiration policies, you can
- specify a named cache region for a particular query by calling
- <literal>Query.setCacheRegion()</literal>.
- </para>
-
- <programlisting role="JAVA"><![CDATA[List blogs = sess.createQuery("from Blog blog where blog.blogger = :blogger")
- .setEntity("blogger", blogger)
- .setMaxResults(15)
- .setCacheable(true)
- .setCacheRegion("frontpages")
- .list();]]></programlisting>
+ <sect2 id="performance-querycache-enable">
+ <title>Enabling query caching</title>
+ <para>
+ Caching of query results introduces some overhead in terms of your applications normal
+ transactional processing. For example, if you cache results of a query against Person
+ Hibernate will need to keep track of when those results should be invalidated because
+ changes have been committed against Person. That, coupled with the fact that most
+ applications simply gain no benefit from caching query results, leads Hibernate to
+ disable caching of query results by default. To use query caching, you will first
+ need to enable the query cache:
+ </para>
+ <programlisting><![CDATA[hibernate.cache.use_query_cache true]]></programlisting>
+ <para>
+ This setting creates two new cache regions:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <classname>org.hibernate.cache.StandardQueryCache</classname>, holding
+ the cached query results
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <classname>org.hibernate.cache.UpdateTimestampsCache</classname>, holding
+ timestamps of the most recent updates to queryable tables. These are used
+ to validate the results as they are served from the query cache.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <important>
+ <para>
+ If you configure your underlying cache implementation to use expiry or
+ timeouts is is very important that the cache timeout of the underlying
+ cache region for the UpdateTimestampsCache be set to a higher value than
+ the timeouts of any of the query caches. In fact, we recommend that the
+ the UpdateTimestampsCache region not be configured for expiry at all. Note,
+ in particular, that an LRU cache expiry policy is never appropriate.
+ </para>
+ </important>
+ <para>
+ As mentioned above, most queries do not benefit from caching or their results. So by
+ default, individual queries are not cached even after enabling query caching. To enable
+ results caching for a particular query, call
+ <literal>org.hibernate.Query.setCacheable(true)</literal>. This call allows the query
+ to look for existing cache results or add its results to the cache when it is executed.
+ </para>
+ <note>
+ <para>
+ The query cache does not cache the state of the actual entities in the cache; it
+ caches only identifier values and results of value type. For this reaso, the query
+ cache should always be used in conjunction with the second-level cache for those
+ entities expected to be cached as part of a query result cache (just as with
+ collection caching).
+ </para>
+ </note>
+ </sect2>
- <para>
- If the query should force a refresh of its query cache region, you should call
- <literal>Query.setCacheMode(CacheMode.REFRESH)</literal>. This is particularly useful
- in cases where underlying data may have been updated via a separate process (i.e.,
- not modified through Hibernate) and allows the application to selectively refresh
- particular query result sets. This is a more efficient alternative to eviction of
- a query cache region via <literal>SessionFactory.evictQueries()</literal>.
- </para>
+ <sect2 id="performance-querycache-regions">
+ <title>Query cache regions</title>
+ <para>
+ If you require fine-grained control over query cache expiration policies, you can
+ specify a named cache region for a particular query by calling
+ <literal>Query.setCacheRegion()</literal>.
+ </para>
+ <programlisting role="JAVA"><![CDATA[List blogs = sess.createQuery("from Blog blog where blog.blogger = :blogger")
+ .setEntity("blogger", blogger)
+ .setMaxResults(15)
+ .setCacheable(true)
+ .setCacheRegion("frontpages")
+ .list();]]></programlisting>
+ <para>
+ If you want to force the query cache to refresh one of its regions (disregard any
+ cached results it finds there) you can use
+ <literal>org.hibernate.Query.setCacheMode(CacheMode.REFRESH)</literal>. In conjunction
+ with the region you have defined for the given query, Hibernate will selectively force
+ the results cached in that particular region to be refreshed. This is particularly useful
+ in cases where underlying data may have been updated via a separate process and is a far more
+ efficient alternative to bulk eviction of the region via
+ <literal>org.hibernate.SessionFactory.evictQueries()</literal>.
+ </para>
+ </sect2>
</sect1>
<sect1 id="performance-collections">
15 years, 1 month