[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.

2009-05-14 Thread Kai Grabfelder (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=12709510#action_12709510
 ] 

Kai Grabfelder commented on IBATIS-464:
---

what do you mean oyu get similar error message? Please post a stacktrace. 
Furthermore you should use inject the datasource into the 
sqlmapclientfactorybean. There should be no need for you to have a datasource 
in your DAOs

 iBatis throws a NPE when performing a sub-select in a resultMap.
 

 Key: IBATIS-464
 URL: https://issues.apache.org/jira/browse/IBATIS-464
 Project: iBatis for Java
  Issue Type: Bug
  Components: SQL Maps
Affects Versions: 2.2.0, 2.3.0
 Environment: WinXP, Java 1.5, originally discovered when moving to 
 Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0)
Reporter: Mitchell L. Waters III
Priority: Blocker

 iBatis throws a NullPointerException when performing a sub-select in a 
 resultMap. 
 For some foo record in the DB, there are a variable number of comments. 
 iBatis allows the user to return an object that contains the information from 
 the foo table and return the list/array/collection of related items (comments 
 in this example) from a separate table that relate to the foo record, using a 
 resultMap like what is listed below.
 resultMap class=test.FooDto id=fooResult
   result property=foo column=foo /
   result property=bar column=bar /
   result property=comments select=getCommentList column={foo=foo} 
 /
 /resultMap
 This works without a hitch in iBatis 2.1.7. However when you attempt to do 
 the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). 
 Digging in a bit, it seems that the session returned to do the SessionScope 
 that is returned for the sub-select is different than that used to run the 
 original select (different than the behavior in 2.1.7) and that the 
 transaction/transaction manager for the new SessionScope object is null. It 
 ends up throwing when it attempts to start a new transaction for the 
 sub-select. 
 I originally saw this problem when updating my application to use Spring 
 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), 
 but upon further investigation I was able to isolate it to being in the 
 ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with 
 an older version (2.1.7) of iBatis, and this works fine. While testing the 
 problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and 
 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0.
 Hopefully, this will be fixed but until then we will be sticking with 2.1.7.
 Thank you,
 Mitch Waters
 org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; 
 uncategorized SQLException for SQL []; SQL state [null]; error code [0];   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException; nested exception is 
 com.ibatis.common.jdbc.exception.NestedSQLException:   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException
 Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException
   at 
 com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
   at 
 com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
   at 
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
   at 
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
   at 
 com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:261)
   at 

[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.

2007-10-03 Thread Jeff Butler (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532170
 ] 

Jeff Butler commented on IBATIS-464:


I believe this is a known issue with a simple fix...In your Spring 
configuration, make sure that you inject the datasource into the SqlMapClient 
ONLY - not each DAO.

Please verify that you are only injecting the datasource into the SqlMapClient 
only and then report back to us.

 iBatis throws a NPE when performing a sub-select in a resultMap.
 

 Key: IBATIS-464
 URL: https://issues.apache.org/jira/browse/IBATIS-464
 Project: iBatis for Java
  Issue Type: Bug
  Components: SQL Maps
Affects Versions: 2.2.0, 2.3.0
 Environment: WinXP, Java 1.5, originally discovered when moving to 
 Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0)
Reporter: Mitchell L. Waters III
Priority: Blocker

 iBatis throws a NullPointerException when performing a sub-select in a 
 resultMap. 
 For some foo record in the DB, there are a variable number of comments. 
 iBatis allows the user to return an object that contains the information from 
 the foo table and return the list/array/collection of related items (comments 
 in this example) from a separate table that relate to the foo record, using a 
 resultMap like what is listed below.
 resultMap class=test.FooDto id=fooResult
   result property=foo column=foo /
   result property=bar column=bar /
   result property=comments select=getCommentList column={foo=foo} 
 /
 /resultMap
 This works without a hitch in iBatis 2.1.7. However when you attempt to do 
 the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). 
 Digging in a bit, it seems that the session returned to do the SessionScope 
 that is returned for the sub-select is different than that used to run the 
 original select (different than the behavior in 2.1.7) and that the 
 transaction/transaction manager for the new SessionScope object is null. It 
 ends up throwing when it attempts to start a new transaction for the 
 sub-select. 
 I originally saw this problem when updating my application to use Spring 
 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), 
 but upon further investigation I was able to isolate it to being in the 
 ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with 
 an older version (2.1.7) of iBatis, and this works fine. While testing the 
 problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and 
 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0.
 Hopefully, this will be fixed but until then we will be sticking with 2.1.7.
 Thank you,
 Mitch Waters
 org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; 
 uncategorized SQLException for SQL []; SQL state [null]; error code [0];   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException; nested exception is 
 com.ibatis.common.jdbc.exception.NestedSQLException:   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException
 Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException
   at 
 com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
   at 
 com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForList(GeneralStatement.java:123)
   at 
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:615)
   at 
 com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMapExecutorDelegate.java:589)
   at 
 com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessionImpl.java:118)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(SqlMapClientTemplate.java:269)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:194)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResult(SqlMapClientTemplate.java:220)
   at 
 org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapClientTemplate.java:267)
   at 
 

[jira] Commented: (IBATIS-464) iBatis throws a NPE when performing a sub-select in a resultMap.

2007-10-03 Thread Mitchell L. Waters III (JIRA)

[ 
https://issues.apache.org/jira/browse/IBATIS-464?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12532185
 ] 

Mitchell L. Waters III commented on IBATIS-464:
---

Thanks, that fixed it for us.  We were using the Spring helper classes to build 
our daos-- that is, our DAO extends SqlMapClientDaoSupport and we set a 
SqlMapClientTemplate on the DAO.  So, we thought that counted as setting the 
datasource on the SqlMapClient -- obviously not the case, at least for ibatis2. 
 For the record, the following change in our spring config fixed it.

Change:
...
bean id=sqlMapClientTemplate
class=org.springframework.orm.ibatis.SqlMapClientTemplate
property name=sqlMapClient
bean

class=org.springframework.orm.ibatis.SqlMapClientFactoryBean
property name=configLocation

valueclasspath:/sql-map-config.xml/value
/property
/bean
/property
property name=dataSource
ref bean=dataSource /
/property
/bean
...
to:
...
bean id=sqlMapClientTemplate
class=org.springframework.orm.ibatis.SqlMapClientTemplate
property name=sqlMapClient
bean

class=org.springframework.orm.ibatis.SqlMapClientFactoryBean
property name=configLocation

valueclasspath:/sql-map-config.xml/value
/property
property name=dataSource
ref bean=dataSource /
/property
/bean
/property
/bean
...


 iBatis throws a NPE when performing a sub-select in a resultMap.
 

 Key: IBATIS-464
 URL: https://issues.apache.org/jira/browse/IBATIS-464
 Project: iBatis for Java
  Issue Type: Bug
  Components: SQL Maps
Affects Versions: 2.2.0, 2.3.0
 Environment: WinXP, Java 1.5, originally discovered when moving to 
 Spring 2.0.6 (spring-ibatis depends on ibatis 2.3.0)
Reporter: Mitchell L. Waters III
Priority: Blocker

 iBatis throws a NullPointerException when performing a sub-select in a 
 resultMap. 
 For some foo record in the DB, there are a variable number of comments. 
 iBatis allows the user to return an object that contains the information from 
 the foo table and return the list/array/collection of related items (comments 
 in this example) from a separate table that relate to the foo record, using a 
 resultMap like what is listed below.
 resultMap class=test.FooDto id=fooResult
   result property=foo column=foo /
   result property=bar column=bar /
   result property=comments select=getCommentList column={foo=foo} 
 /
 /resultMap
 This works without a hitch in iBatis 2.1.7. However when you attempt to do 
 the same in iBatis 2.2.0 or 2.3.0, you get a NPE (stack trace to follow). 
 Digging in a bit, it seems that the session returned to do the SessionScope 
 that is returned for the sub-select is different than that used to run the 
 original select (different than the behavior in 2.1.7) and that the 
 transaction/transaction manager for the new SessionScope object is null. It 
 ends up throwing when it attempts to start a new transaction for the 
 sub-select. 
 I originally saw this problem when updating my application to use Spring 
 2.0.6 (which uses iBatis 2.3.0 as a dependency of the spring-ibatis module), 
 but upon further investigation I was able to isolate it to being in the 
 ibatis-sqlmap module. I've since set up our project to use Spring 2.0.6 with 
 an older version (2.1.7) of iBatis, and this works fine. While testing the 
 problem, we tested iBatis 2.1.7, 2.2.0 and 2.3.0 with both Spring 1.2.9 and 
 2.0.6, and we only experience the problem with iBatis 2.2.0 and 2.3.0.
 Hopefully, this will be fixed but until then we will be sticking with 2.1.7.
 Thank you,
 Mitch Waters
 org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; 
 uncategorized SQLException for SQL []; SQL state [null]; error code [0];   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the result mapping for the 'roles' property.  
 --- Cause: java.lang.NullPointerException; nested exception is 
 com.ibatis.common.jdbc.exception.NestedSQLException:   
 --- The error occurred in test.xml.  
 --- The error occurred while applying a result map.  
 --- Check the complexResult.  
 --- Check the