ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Butler" <jeffgbut...@gmail.com>
Subject Re: How commit works
Date Tue, 05 Sep 2006 17:33:46 GMT
By default, iBATIS will not commit if you do queryForObject.

You'll need to set the commitRequired attribute of the <transactionManager>
to true.  You can read about this exact situation in the developer's guide.

Jeff Butler


On 9/5/06, Javier Leyba <xleyba@gmail.com> wrote:
>
> Hi
>
> I've defined my sqlmaps with
>
> <transactionManager type="JDBC">
>                <dataSource type="JNDI">
>                        <property name="context.java.naming.factory.initial
> "
>
> value="org.jnp.interfaces.NamingContextFactory" />
>                        <property name="context.java.naming.provider.url"
>                                value="jnp://localhost:2199" />
>                        <property name="
> context.java.naming.factory.url.pkgs"
>                                value="org.jboss.naming:org.jnp.interfaces"
> />
>                        <property name="DataSource"
>                                value="java:comp/env/jdbc/MySQLDB" />
>                        <property name="JDBC.DefaultAutoCommit"
> value="false" />
>                </dataSource>
>        </transactionManager>
>
> and in my program I did:
>
> try {
>                        sqlMap = NotificationsSqlConfig.getSqlMapInstance
> ();
>                        sqlMap.startTransaction();
>                        gr = (GenericResult) sqlMap.queryForObject("insertSourceType",
> sourceTypeId);
>                        sqlMap.commitTransaction();
>                } catch (Exception e) {
>                        logger.error("insertSourceType(String)", e);
> //$NON-NLS-1$
>                        throw new RemoteException(e.getMessage(),e);
>                } finally {
>                        try {
>                                sqlMap.endTransaction();
>                        } catch (Exception e) {
>                                throw new RemoteException(e.getMessage
> (),e);
>                        }
>                }
>
>
> to call a storedProcedure.
>
> The stored procedure return me 1 row affected but data is never inserted
> in DB.
>
> But, if I call stored procedure from a sql console it work well.
>
> Is there something I forget in my config ?
>
> Thanks in advance
>
>
>
> J
>

Mime
View raw message