ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Clinton Begin <clinton.be...@gmail.com>
Subject Re: transactions
Date Tue, 24 May 2005 19:34:57 GMT
As great as that tutorial was for iBATIS 1.x, it holds little value for the 
2.0 framework.

For one, the new exception handling paradigm is completely different.

Please see the Tutorial available at www.ibatis.com
<http://www.ibatis.com>and JPetStore 4.

Cheers,
Clinton

On 5/24/05, Lieven De Keyzer <lieven_dekeyzer@hotmail.com> wrote:
> 
> At http://www.reumann.net/struts/ibatisLesson1/step6.do
> this is an example in a ibatis/struts tutorial
> 
> public int update(String statementName, Object parameterObject) throws
> DaoException {
> int result = 0;
> try {
> sqlMap.startTransaction();
> result = sqlMap.executeUpdate(statementName, parameterObject);
> sqlMap.commitTransaction();
> } catch (SQLException e) {
> try {
> sqlMap.rollbackTransaction();
> } catch (SQLException ex) {
> throw new DaoException(ex.fillInStackTrace());
> }
> throw new DaoException(e.fillInStackTrace());
> }
> return result;
> }
> 
> Is it necessary to have a transaction started for just 1 statement
> execution?
> 
> Also, what's the better way? Doing a transaction in a Service class, that
> has multiple DAO's, or doing it in the DAO class, doing different 
> statements
> in one method? Or is there no difference?
> 
> 
>

Mime
View raw message