Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 41280 invoked from network); 6 Sep 2005 08:47:23 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 6 Sep 2005 08:47:23 -0000 Received: (qmail 6163 invoked by uid 500); 6 Sep 2005 08:47:17 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 6143 invoked by uid 500); 6 Sep 2005 08:47:17 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 6115 invoked by uid 99); 6 Sep 2005 08:47:17 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Sep 2005 01:47:17 -0700 X-ASF-Spam-Status: No, hits=1.4 required=10.0 tests=DNS_FROM_RFC_ABUSE,RCVD_IN_NJABL_PROXY X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [217.12.10.175] (HELO web25703.mail.ukl.yahoo.com) (217.12.10.175) by apache.org (qpsmtpd/0.29) with SMTP; Tue, 06 Sep 2005 01:47:29 -0700 Received: (qmail 9953 invoked by uid 60001); 6 Sep 2005 08:47:13 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.es; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=6l2KjvF8vizCuUXZq1SHwFk055mm4LvPr0AO0Meyfhm+J133Jn3m3kiPKzfS46epasZFLCOr566r3hn2sMIne3UfKlIACFfhkPGeINa8ypdbzccjWExBAR5qQIXyZATcS6gMisd/DZloRuUgSI2Amp5nDNp6uodkEIY+hGlfxcU= ; Message-ID: <20050906084712.9950.qmail@web25703.mail.ukl.yahoo.com> Received: from [213.60.22.195] by web25703.mail.ukl.yahoo.com via HTTP; Tue, 06 Sep 2005 10:47:12 CEST Date: Tue, 6 Sep 2005 10:47:12 +0200 (CEST) From: Cesar Villar Subject: RE: probe that my ibatis runs. SOS please help me To: user-java@ibatis.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Muy buenas!!! Necesitas una clase que carge tu configuraci�n. Te mando el c�digo de la m�a con la que realizo las transacciones. Lo �nico que tienes que hacer es extender a la que te mando y utilizar los m�todos de la superclase, o sea, los de mi clase abstracta, desde la subclase. public class AbstractUnafeDAO implements IUnafeDAO { public static int INSERT_BATCH = 0; public static int DELETE_BATCH = 1; public static int UPDATE_BATCH = 2; private static Log log = LogFactory.getLog(AbstractUnafeDAO.class); private static SqlMapClient sqlMap = null; static { // CARGA ESTATICA DE LOS PARAMETROS try { String resource = "com/unafe/dao/conf/sql-map-config.xml"; Reader reader = Resources.getResourceAsReader(resource); sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader); reader.close(); } catch (Exception ex) { log.error("AbstractUnafeDAO static block: " + ex); throw new RuntimeException("Error Initializing AbstractUnafeDAO :" + ex); } } public final List getList(String statementName, Object parameterObject) throws SQLException { List list = null; try { sqlMap.startTransaction(); list = sqlMap.queryForList(statementName, parameterObject); sqlMap.commitTransaction(); } catch (SQLException e) { try { sqlMap.endTransaction(); } catch (SQLException ex) { log.error("AbstractUnafeDAO getList.endTransaction: " + ex); throw ex; } log.error("AbstractUnafeDAO getList.commitTransaction: " + e); throw e; } return list; } public final Object getObject(String statementName, Object parameterObject) throws SQLException { Object result = null; try { sqlMap.startTransaction(); result = sqlMap.queryForObject(statementName, parameterObject); sqlMap.commitTransaction(); } catch (SQLException e) { try { sqlMap.endTransaction(); } catch (SQLException ex) { log.error("AbstractUnafeDAO getObject.endTransaction: " + ex); throw ex; } log.error("AbstractUnafeDAO getObject.commitTransaction: " + e); throw e; } return result; } public final int update(String statementName, Object parameterObject) throws SQLException { int result = 0; try { sqlMap.startTransaction(); result = sqlMap.update(statementName, parameterObject); sqlMap.commitTransaction(); } catch (SQLException e) { try { sqlMap.endTransaction(); } catch (SQLException ex) { log.error("AbstractUnafeDAO update.endTransaction: " + ex); throw ex; } log.error("AbstractUnafeDAO update.commitTransaction: " + e); throw e; } return result; } public final void insert(String statementName, Object parameterObject) throws SQLException { try { sqlMap.startTransaction(); sqlMap.insert(statementName, parameterObject); sqlMap.commitTransaction(); } catch (SQLException e) { try { sqlMap.endTransaction(); } catch (SQLException ex) { log.error("AbstractUnafeDAO insert.endTransaction: " + ex); throw ex; } log.error("AbstractUnafeDAO insert.commitTransaction: " + e); throw e; } } public final void delete(String statementName, Object parameterObject) throws SQLException { try { sqlMap.startTransaction(); sqlMap.delete(statementName, parameterObject); sqlMap.commitTransaction(); } catch (SQLException e) { try { sqlMap.endTransaction(); } catch (SQLException ex) { log.error("AbstractUnafeDAO delete.endTransaction: " + ex); throw ex; } log.error("AbstractUnafeDAO delete.commitTransaction: " + e); throw e; } /* finally{ try { sqlMap.endTransaction(); } catch (SQLException ex) { throw ex; } } */ } public final void executeBatch(int accion, String statementName, List objs) throws SQLException{ try { sqlMap.startTransaction(); sqlMap.startBatch(); for(int i=0;i