diff --git a/src/org/openbravo/dal/core/SessionHandler.java b/src/org/openbravo/dal/core/SessionHandler.java
--- a/src/org/openbravo/dal/core/SessionHandler.java
+++ b/src/org/openbravo/dal/core/SessionHandler.java
@@ -20,6 +20,7 @@
 package org.openbravo.dal.core;
 
 import java.io.Serializable;
+import java.sql.BatchUpdateException;
 import java.sql.Connection;
 import java.sql.SQLException;
 
@@ -29,6 +30,7 @@
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.hibernate.Transaction;
+import org.openbravo.base.exception.OBException;
 import org.openbravo.base.model.Entity;
 import org.openbravo.base.provider.OBNotSingleton;
 import org.openbravo.base.provider.OBProvider;
@@ -271,6 +273,9 @@
       }
       tx = null;
       err = false;
+    } catch (BatchUpdateException buex) {
+      log.error("Error while closing the connection", buex);
+      throw new OBException(buex.getNextException());
     } catch (SQLException e) {
       log.error("Error while closing the connection", e);
     } finally {
