diff --git a/core/org.wso2.carbon.registry.core/src/main/java/org/wso2/carbon/registry/core/jdbc/dao/JDBCPathCache.java b/core/org.wso2.carbon.registry.core/src/main/java/org/wso2/carbon/registry/core/jdbc/dao/JDBCPathCache.java index 9db145b8572..287ba9c7063 100644 --- a/core/org.wso2.carbon.registry.core/src/main/java/org/wso2/carbon/registry/core/jdbc/dao/JDBCPathCache.java +++ b/core/org.wso2.carbon.registry.core/src/main/java/org/wso2/carbon/registry/core/jdbc/dao/JDBCPathCache.java @@ -31,6 +31,7 @@ import org.wso2.carbon.registry.core.jdbc.dataaccess.AbstractConnection; import org.wso2.carbon.registry.core.jdbc.dataaccess.ConnectionWrapper; import org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDataAccessManager; +import org.wso2.carbon.registry.core.jdbc.dataaccess.JDBCDatabaseTransaction; import org.wso2.carbon.registry.core.session.CurrentSession; import org.wso2.carbon.registry.core.utils.RegistryUtils; import org.wso2.carbon.utils.DBUtils; @@ -84,18 +85,9 @@ public int addEntry(String path, int parentPathId) throws SQLException, Registry log.error(msg); throw new RegistryException(msg); } - DataSource dataSource = ((JDBCDataAccessManager)dataAccessManager).getDataSource(); - AbstractConnection conn = new ConnectionWrapper(dataSource.getConnection(), - RegistryUtils.getConnectionId(dataSource)); - if (conn != null) { - if (conn.getTransactionIsolation() != Connection.TRANSACTION_READ_COMMITTED) { - conn.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED); - } - conn.setAutoCommit(false); - } else { - log.error("Unable to acquire connection to database."); - return -1; - } + JDBCDatabaseTransaction.ManagedRegistryConnection conn = + JDBCDatabaseTransaction.getConnection(); + boolean success = false; int pathId = 0;