ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warner Onstine" <warn...@gmail.com>
Subject trying to bypass xml config/mapping
Date Mon, 19 Nov 2007 19:47:12 GMT
Ok, so admittedly I'm pushing things a bit here, but I'm hoping
someone can help me see what I'm doing wrong (or point me in the right
direction. I am attempting to write a small groovy framework that gets
rid of the xml config and mapping files.

Where I'm running into trouble right now is in running my test. I have
a basic config setup and one MappedStatement. I know that my statement
is setup as when I query the delegate it comes back with my current
statement. But when I run the test it just "hangs" in some kind of
infinite loop.

I've tracked this down to this piece of code, but can't figure out why
it's dying:

SqlMapExecutorDelegate
  public void startTransaction(SessionScope session) throws SQLException {
    try {
      txManager.begin(session);
    } catch (TransactionException e) {
      throw new NestedSQLException("Could not start transaction.
Cause: " + e, e);
    }
  }

I'm sure it's because I missed some configuration property when I was
setting up the delegate but I'm not sure what it might be. Here's my
groovy version of setting up the delegate:

	def public SqlMapClient buildSqlMapClient(DBConfiguration config) {
        def connection = config.getTestConnection()
	    def delegate = new SqlMapExecutorDelegate()
        def client = new SqlMapClientImpl(delegate)
        def dsConfig = ["JDBC.Driver": connection.driver,
                        "JDBC.ConnectionURL": connection.url +
connection.dbName,
                        "JDBC.Username": connection.username,
                        "JDBC.Password": connection.password,
                        "JDBC.DefaultAutoCommit": "false"]
        def ds = new SimpleDataSource(dsConfig)
        def txMgrConfig = new JdbcTransactionConfig()
        txMgrConfig.setDataSource(ds)
        def txManager = new TransactionManager(txMgrConfig)
        delegate.setTxManager(txManager)
        addStatements(delegate)
        return client
	}

Thanks in advance for all the help!

-warner

-- 
Warner Onstine - Programmer/Author
New book on Tapestry 4!
Tapestry 101 available at
http://sourcebeat.com/books/tapestrylive.html
warner@warneronstine.com
http://warneronstine.com/blog

Mime
View raw message