Index: extensions/modeshape-connector-store-jpa/src/main/java/org/modeshape/connector/store/jpa/JpaSource.java =================================================================== --- extensions/modeshape-connector-store-jpa/src/main/java/org/modeshape/connector/store/jpa/JpaSource.java (revision 2576) +++ extensions/modeshape-connector-store-jpa/src/main/java/org/modeshape/connector/store/jpa/JpaSource.java (working copy) @@ -170,7 +170,11 @@ public class JpaSource implements RepositorySource, ObjectFactory { */ public static final String DEFAULT_NAME_OF_DEFAULT_WORKSPACE = "default"; - private static final int DEFAULT_ISOLATION_LEVEL = Connection.TRANSACTION_REPEATABLE_READ; + /** + * The default value for {@link #setIsolationLevel(Integer)} is 'null', meaning this source does not explicitly set the + * isolation level, so the JDBC DataSource's own level will be used. + */ + private static final Integer DEFAULT_ISOLATION_LEVEL = null; private static final int DEFAULT_RETRY_LIMIT = 0; private static final int DEFAULT_CACHE_TIME_TO_LIVE_IN_SECONDS = 60 * 5; // 5 minutes @@ -315,7 +319,7 @@ public class JpaSource implements RepositorySource, ObjectFactory { @Description( i18n = JpaConnectorI18n.class, value = "isolationLevelPropertyDescription" ) @Label( i18n = JpaConnectorI18n.class, value = "isolationLevelPropertyLabel" ) @Category( i18n = JpaConnectorI18n.class, value = "isolationLevelPropertyCategory" ) - private volatile int isolationLevel = DEFAULT_ISOLATION_LEVEL; + private volatile Integer isolationLevel = DEFAULT_ISOLATION_LEVEL; @Description( i18n = JpaConnectorI18n.class, value = "predefinedWorkspacesPropertyDescription" ) @Label( i18n = JpaConnectorI18n.class, value = "predefinedWorkspacesPropertyLabel" ) @@ -912,19 +916,30 @@ public class JpaSource implements RepositorySource, ObjectFactory { } /** - * @return isolationLevel + * Get the JDBC transaction isolation level that should be used. Note that if the isolation level is not set (the value is + * null), then this source does not explicitly set the isolation level, so the data source's value will implicitly be used. + * + * @return isolationLevel the value of the isolation level, or null if the isolation level is not set by this source (meaning + * the data source's current setting or its default will be used) */ - public int getIsolationLevel() { + public Integer getIsolationLevel() { return isolationLevel; } /** - * @param isolationLevel Sets isolationLevel to the specified value. + * Set the JDBC transaction isolation level that should be used. Note that if the isolation level is not set (the value is + * null), then this source does not explicitly set the isolation level, so the data source's value will implicitly be used. + * + * @param isolationLevel the value of the isolation level, or null if the isolation level is not set by this source (meaning + * the data source's current setting or its default will be used) */ public synchronized void setIsolationLevel( Integer isolationLevel ) { - if (isolationLevel == null) isolationLevel = DEFAULT_ISOLATION_LEVEL; + if (isolationLevel == null) { + isolationLevel = DEFAULT_ISOLATION_LEVEL; + } - if (isolationLevel != Connection.TRANSACTION_NONE && isolationLevel != Connection.TRANSACTION_READ_COMMITTED + if (isolationLevel != DEFAULT_ISOLATION_LEVEL && isolationLevel != Connection.TRANSACTION_NONE + && isolationLevel != Connection.TRANSACTION_READ_COMMITTED && isolationLevel != Connection.TRANSACTION_READ_UNCOMMITTED && isolationLevel != Connection.TRANSACTION_REPEATABLE_READ && isolationLevel != Connection.TRANSACTION_SERIALIZABLE) { throw new RepositorySourceException(this.name, JpaConnectorI18n.invalidIsolationLevel.text(isolationLevel)); @@ -1109,7 +1124,9 @@ public class JpaSource implements RepositorySource, ObjectFactory { // Set the Hibernate properties used in all situations ... setProperty(configurator, "hibernate.dialect", this.dialect); - setProperty(configurator, "hibernate.connection.isolation", this.isolationLevel); + if (this.isolationLevel != null) { + setProperty(configurator, "hibernate.connection.isolation", this.isolationLevel); + } // Configure additional properties, which may be overridden by subclasses ... configure(configurator); Index: extensions/modeshape-connector-store-jpa/src/main/resources/org/modeshape/connector/store/jpa/JpaConnectorI18n.properties =================================================================== --- extensions/modeshape-connector-store-jpa/src/main/resources/org/modeshape/connector/store/jpa/JpaConnectorI18n.properties (revision 2576) +++ extensions/modeshape-connector-store-jpa/src/main/resources/org/modeshape/connector/store/jpa/JpaConnectorI18n.properties (working copy) @@ -36,7 +36,7 @@ locationShouldHavePathAndOrProperty = The source {0} is unable to find a node wi invalidUuidForWorkspace = There is no node with UUID "{0}" in workspace "{1}" invalidReferences = One or more references were invalid in {0} unableToDeleteBecauseOfReferences = At least one deleted node is referenced by a node that is not being deleted -invalidIsolationLevel = An invalid isolation level "{0}" was specified and will be ignored. Valid isolation levels are TRANSACTION_NONE, TRANSACTION_READ_COMMITTED, TRANSACTION_READ_UNCOMMITTED, TRANSACTION_REPEATABLE_READ, and TRANSACTION_SERIALIZABLE from the java.sql.Connection class. +invalidIsolationLevel = An invalid isolation level "{0}" was specified. Valid isolation levels are '0' for TRANSACTION_NONE, '1' for TRANSACTION_READ_UNCOMMITTED, '2' for TRANSACTION_READ_COMMITTED, '4' for TRANSACTION_REPEATABLE_READ, and '8' for TRANSACTION_SERIALIZABLE (as defined in the java.sql.Connection class). The default is to not set this, which means that the isolation will not be set (and the JDBC DataSource's own isolation level will be used).