You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user-java@ibatis.apache.org by Ralf Assmann <ra...@innovations.de> on 2008/02/20 10:26:38 UTC
Using TransactionManager And User Connection
Hi there,
we are using iBATIS within our own framework and do not use spring or
anything else. For this, we get the connection to the database from our
own connection pool.
Now, we want to use iBATIS calling SqlMapClient.startTransaction().
Here, we always get a NullPointer-exception, because no transaction
manager has been set. The code looks anything like this, simplified:
// get our own connection from our own connection pool
Connection con = ConnectionPool.getConnection();
// creating the sqlMapClient
SqlMapClient sqlMapClient = ...;
// setting the user connection
sqlMapClient.setUserConnection(con);
// open the session
sqlMapClient.openSession();
// calling startTransaction (1)
sqlMapClient.startTransaction();
// doing the implementation
...
// doing the commit
sqlMapClient.commitTransaction();
// ending the transaction
sqlMapClient.endTransaction();
At line (1), ...startTransaction(), we get the error.
How to put a transaction manager to the sqlMapClient while using an own
user connection? How to tell sqlMapClient the transaction manager it has
to use? It is not possible the define it using sqlMapConfig.xml, or?
Many thanks for your answers ...
Best regards,
Ralf