ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ashish Kulkarni" <ashish.kulkarn...@gmail.com>
Subject Re: Error with ibatis runing queryForList
Date Thu, 23 Oct 2008 03:04:14 GMT
Hi

This is my code

// Create SQlMapClient

Properties prop = new Properties();
  prop.setProperty("url", url.trim());
  prop.setProperty("driver", driver);
  prop.setProperty("username", userid);
  prop.setProperty("password", password);

String resource = "SQLMapConfigWeb.xml";
Reader reader = Resources.getResourceAsReader(resource);

SqlMapClient sqlMapClient = SqlMapClientBuilder.buildSqlMapClient(reader,
prop);

//SQLConfig xml file
<sqlMapConfig>
<settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="32" maxSessions="10"
maxTransactions="5" useStatementNamespaces="false" />
<sqlMap resource="PODataExternalTable.xml" />
</sqlMapConfig>
//java code
Map map = new Hashtable();
  map.put("SYSTEM", system);
  map.put("USER",user);
  map.put("ENVNAME",envName);

sqlMapClient.queryForList("getPOHeader",map);
//Sql statement
<select id="getPOHeader" resultClass="com.pfizer.maps.data.PODataBean">
 SELECT * FROM POHEADER WHERE SYSTEM = #SYSTEM#
  and USER = #USER# and ENVNAME =#ENVNAME#
 </select>

When i change my SQLConfig xml file as below and get the driver url etc
from SqlMapConfig.properties, it works.
What am i missing
<sqlMapConfig>
<properties resource="SqlMapConfig.properties" />
<settings cacheModelsEnabled="true" enhancementEnabled="true"
lazyLoadingEnabled="true" maxRequests="32" maxSessions="10"
maxTransactions="5" useStatementNamespaces="false" />
<transactionManager type="JDBC">
  <dataSource type="SIMPLE">
  <property name="JDBC.Driver" value="${driver}" />

  <property name="JDBC.ConnectionURL" value="${url}" />

  <property name="JDBC.Username" value="${username}" />

  <property name="JDBC.Password" value="${password}" />

  </dataSource>
  </transactionManager>
<sqlMap resource="PODataExternalTable.xml" />
</sqlMapConfig>


On Wed, Oct 22, 2008 at 4:16 PM, Yamil Bracho <yamilbracho@hotmail.com>wrote:

>
> Would you mind to us your mapping and java code.. ?
> ------------------------------
> Date: Wed, 22 Oct 2008 15:55:33 -0400
> From: ashish.kulkarni13@gmail.com
> To: user-java@ibatis.apache.org
> Subject: Error with ibatis runing queryForList
>
> Hi
>
> I am gettig following error when trying to sqlSession.queryForList()
>
>
>  com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.endTransaction(SqlMapExecutorDelegate.java:776)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.endTransaction(SqlMapSessionImpl.java:141)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.endTransaction(SqlMapClientImpl.java:114)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.autoEndTransaction(SqlMapExecutorDelegate.java:860)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:617)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:584)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:105)
>  at
> com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClientImpl.java:77)
>
>
> what may be the issue
>
>
> ------------------------------
> Ahora llévate lo mejor de MSN y Windows Live, en tu móvil<http://serviciosmoviles.es.msn.com/>
>

Mime
View raw message