public boolean execDelete ( Class < ? extends D6Model > modelObj ) { boolean retVal = false ; final D6CrudDeleteHelper dh = new D6CrudDeleteHelper ( modelObj ) ; final String updateSQL = dh . createDeleteAllPreparedSQLStatement ( ) ; log ( "#execDelete model=" + modelObj + " deleteSQL=" + updateSQL ) ; final Connection conn = createConnection ( ) ; try { PreparedStatement preparedStmt = null ; // There is a possibility that the error occurs in one single delete // statement. // Therefore, turn the auto commit off. conn . setAutoCommit ( false ) ; preparedStmt = conn . prepareStatement ( updateSQL ) ; // execute SQL preparedStmt . executeUpdate ( ) ; // Finally, commit. conn . commit ( ) ; retVal = true ; } catch ( SQLException e ) { loge ( "#execDelete" , e ) ; retVal = false ; } finally { try { conn . close ( ) ; } catch ( SQLException e ) { retVal = false ; loge ( "#execDelete" , e ) ; } } return retVal ; }
Delete the appropriate line in the specified model object