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: Cannot find replacements in API for rollback, etc.
Date Mon, 21 Nov 2005 20:54:02 GMT
Here's the conversion...to make it even simpler, try extending
SqlMapDaoTemplate, which will deal with exceptions for you.

public List getList(String statementName, Object parameterObject) throws
SQLException {
List list = null;

try {
sqlMap.startTransaction();
list = sqlMap.queryForList(statementName, parameterObject);
sqlMap.commitTransaction();
} finally {
sqlMap.endTransaction();
}

return list;
}


Clinton

On 11/21/05, Scott Purcell <spurcell@vertisinc.com> wrote:
>
> Hello,
>
> I have the following snippet from an example Ibatis 1.x and I am trying to
> recreate it in 2.0. I am new, and just getting underway. Problem is today,
> I cannot find a replacement for the line sqlMap.rollbackTransaction(),
>
> I have the API up, and under sqlMapClient cannot find a rollback
> replacement. Could someone give me some ideas here?
>
>
> (converting this to 2.0)
> public List getList(String statementName, Object parameterObject) throws
> DaoException {
> List list = null;
>
> try {
> sqlMap.startTransaction();
> list = sqlMap.queryForList(statementName, parameterObject);
> sqlMap.commitTransaction();
> } catch (SQLException e) {
> try {
> sqlMap.rollbackTransaction();
> } catch (SQLException ex) {
> throw new DaoException(ex.fillInStackTrace());
> }
>
> throw new DaoException(e.fillInStackTrace());
> }
>
> return list;
> }
>
>
>
>

Mime
View raw message