Hemant.Kamatgi | 1 Oct 2007 23:17

SQL fired by iBATIS

Hi,

 

I want to see the ‘SQL’ that iBATIS is firing to the Database. We are curious to see how the results are fetched for ‘queryForList(String id, Object parameterObject, int skip, int max)’  method.

 

Can anyone please let me know abt this?

 

Regards

Hemant

 

 

 

Jeff Butler | 1 Oct 2007 23:22
Picon

Re: SQL fired by iBATIS

See the developer's guide about enabling iBATIS logging.
 
Jeff Butler


 
On 10/1/07, Hemant. Kamatgi <Hemant.Kamatgi <at> target.com> wrote:

Hi,

 

I want to see the 'SQL' that iBATIS is firing to the Database. We are curious to see how the results are fetched for 'queryForList(String id, Object parameterObject, int skip, int max)'  method.

 

Can anyone please let me know abt this?

 

Regards

Hemant

 

 

 


Larry Meadors | 2 Oct 2007 04:15
Picon
Favicon

Re: SQL fired by iBATIS

The SQL is run exactly as it is in the sql map, but the (skip) results
are skipped, and only (max) rows are mapped to objects.

To answer what I think your question is: The limiting is done in Java,
not in SQL.

There is no SQL standard for limiting the results, so we let you do it
this way (easy, but not terribly efficient), or in your SQL (harder,
but lots more efficient).

Larry

> I want to see the 'SQL' that iBATIS is firing to the Database. We are
> curious to see how the results are fetched for 'queryForList(String id,
> Object parameterObject, int skip, int max)'  method.

Jonathan Alvarsson | 2 Oct 2007 11:02
Picon
Gravatar

Lazy loading -- IllegalArgumentException: argument type mismatch

I have tried to activate the lazy loading in iBatis. From working perfectly without lazy loading I turn into lot's of exceptions like this one:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject (GeneralStatement.java:104)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java :541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:243)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:241)
    at net.bioclipse.structuredb.persistency.dao.GenericDao.getById (GenericDao.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java:177)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
    at net.bioclipse.structuredb.persistency.dao.FetchIntroductionInterceptor.invoke (FetchIntroductionInterceptor.java:36)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)
    at $Proxy6.getById(Unknown Source)
    at net.bioclipse.structuredb.persistency.dao.GenericDaoTest.testUpdate(GenericDaoTest.java:122)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke (Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java :69)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:47)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run (AbstractAnnotationAwareTransactionalTests.java:115)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:180)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed (AbstractAnnotationAwareTransactionalTests.java:153)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:111)
    at junit.framework.TestResult$1.protect (TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:38)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a'.  Cause: java.lang.IllegalArgumentException : argument type mismatch
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)
    at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java :112)
    at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373)
    at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java :64)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery (SqlExecutor.java:190)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback (GeneralStatement.java:173)
    ... 45 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties (PropertyAccessPlan.java:46)
    ... 53 more

What am I doing wrong? Do I need interfaces for my domain objects? I didn't need it when using Hibernate so I thought that maybe... Or what?

--
// Jonathan
Jonathan Alvarsson | 2 Oct 2007 11:07
Picon
Gravatar

Re: Mapping HSQLDB's binary using iBatis

On 9/28/07, Yee, Richard K CTR DMDC <Richard.Yee.ctr <at> osd.pentagon.mil> wrote:

What does the code look like that you are using to call the
sqlMap.insert() with? It looks like you are passing in a string for the
byte[]

I changed approach and now persists a String serialisation of the object instead. But thanks anyway for your time! 

--
// Jonathan
Niels Beekman | 2 Oct 2007 11:15
Picon

RE: Lazy loading -- IllegalArgumentException: argument type mismatch

Please post relevant SQLMap and net.bioclipse.structuredb.domain.Library code. It’s difficult to see what’s going on without them.

 

Niels

From: Jonathan Alvarsson [mailto:jonathan.alvarsson <at> gmail.com]
Sent: dinsdag 2 oktober 2007 11:02
To: user-java <at> ibatis.apache.org
Subject: Lazy loading -- IllegalArgumentException: argument type mismatch

 

I have tried to activate the lazy loading in iBatis. From working perfectly without lazy loading I turn into lot's of exceptions like this one:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject (GeneralStatement.java:104)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java :541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:243)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:241)
    at net.bioclipse.structuredb.persistency.dao.GenericDao.getById (GenericDao.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java:177)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
    at net.bioclipse.structuredb.persistency.dao.FetchIntroductionInterceptor.invoke (FetchIntroductionInterceptor.java:36)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)
    at $Proxy6.getById(Unknown Source)
    at net.bioclipse.structuredb.persistency.dao.GenericDaoTest.testUpdate(GenericDaoTest.java:122)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke (Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java :69)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:47)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run (AbstractAnnotationAwareTransactionalTests.java:115)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:180)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed (AbstractAnnotationAwareTransactionalTests.java:153)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:111)
    at junit.framework.TestResult$1.protect (TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:38)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a'.  Cause: java.lang.IllegalArgumentException : argument type mismatch
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)
    at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java :112)
    at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373)
    at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java :64)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery (SqlExecutor.java:190)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback (GeneralStatement.java:173)
    ... 45 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties (PropertyAccessPlan.java:46)
    ... 53 more

What am I doing wrong? Do I need interfaces for my domain objects? I didn't need it when using Hibernate so I thought that maybe... Or what?

--
// Jonathan

Jonathan Alvarsson | 2 Oct 2007 12:20
Picon
Gravatar

Re: Lazy loading -- IllegalArgumentException: argument type mismatch

I will interpret this as "You don't need interfaces for the proxying in lazy loading to work" and send some more info. Attached are a lot of files... :)

On 10/2/07, Niels Beekman <n.beekman <at> wis.nl> wrote:

Please post relevant SQLMap and net.bioclipse.structuredb.domain.Library code. It's difficult to see what's going on without them.

 

Niels

From: Jonathan Alvarsson [mailto:jonathan.alvarsson <at> gmail.com]
Sent: dinsdag 2 oktober 2007 11:02
To: user-java <at> ibatis.apache.org
Subject: Lazy loading -- IllegalArgumentException: argument type mismatch

 

I have tried to activate the lazy loading in iBatis. From working perfectly without lazy loading I turn into lot's of exceptions like this one:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject (GeneralStatement.java:104)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java :541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:243)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:241)
    at net.bioclipse.structuredb.persistency.dao.GenericDao.getById (GenericDao.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java:177)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
    at net.bioclipse.structuredb.persistency.dao.FetchIntroductionInterceptor.invoke (FetchIntroductionInterceptor.java:36)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)
    at $Proxy6.getById(Unknown Source)
    at net.bioclipse.structuredb.persistency.dao.GenericDaoTest.testUpdate(GenericDaoTest.java:122)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke (Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java :69)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:47)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run (AbstractAnnotationAwareTransactionalTests.java:115)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:180)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed (AbstractAnnotationAwareTransactionalTests.java:153)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:111)
    at junit.framework.TestResult$1.protect (TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:38)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a'.  Cause: java.lang.IllegalArgumentException : argument type mismatch
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)
    at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java :112)
    at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373)
    at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java :64)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery (SqlExecutor.java:190)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback (GeneralStatement.java:173)
    ... 45 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties (PropertyAccessPlan.java:46)
    ... 53 more

What am I doing wrong? Do I need interfaces for my domain objects? I didn't need it when using Hibernate so I thought that maybe... Or what?

--
// Jonathan




--
// Jonathan
Attachment (sqlMap.xml): text/xml, 6790 bytes
Attachment (BaseObject.java): text/x-java, 5653 bytes
Attachment (Library.java): text/x-java, 2191 bytes
Attachment (GenericDaoTest.java): text/x-java, 4236 bytes
Attachment (LibraryDaoTest.java): text/x-java, 727 bytes
Niels Beekman | 2 Oct 2007 12:51
Picon

RE: Lazy loading -- IllegalArgumentException: argument type mismatch

Somehow, iBATIS doesn’t recognize the ‘structures’ property and decides to go for the ‘setStructures’ property, if you ask me, there’s something seriously wrong with that. You could try to replace the Set with a List or Collection, just to see if it works then, otherwise I suggest you fire up the debugger and find out what’s wrong. Frm what I could trace back from the provided info is that you’re invoking the ‘Library.getById’ select? Try executing that in a simple class, without all the test-framework stuff in place. In particular I don’t understand how it could work without lazy loading, that shouldn’t matter at all. I’m afraid I can’t help with this any further…

 

Niels

From: Jonathan Alvarsson [mailto:jonathan.alvarsson <at> gmail.com]
Sent: dinsdag 2 oktober 2007 12:21
To: user-java <at> ibatis.apache.org
Subject: Re: Lazy loading -- IllegalArgumentException: argument type mismatch

 

I will interpret this as "You don't need interfaces for the proxying in lazy loading to work" and send some more info. Attached are a lot of files... :)

On 10/2/07, Niels Beekman <n.beekman <at> wis.nl> wrote:

Please post relevant SQLMap and net.bioclipse.structuredb.domain.Library code. It's difficult to see what's going on without them.

 

Niels

From: Jonathan Alvarsson [mailto:jonathan.alvarsson <at> gmail.com]
Sent: dinsdag 2 oktober 2007 11:02
To: user-java <at> ibatis.apache.org
Subject: Lazy loading -- IllegalArgumentException: argument type mismatch

 

I have tried to activate the lazy loading in iBatis. From working perfectly without lazy loading I turn into lot's of exceptions like this one:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in sqlMap.xml. 
--- The error occurred while applying a result map. 
--- Check the Library. 
--- The error happened while setting a property on the result object. 
--- Cause: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a '.  Cause: java.lang.IllegalArgumentException: argument type mismatch
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback(GeneralStatement.java:188)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryForObject (GeneralStatement.java:104)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java:566)
    at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForObject(SqlMapExecutorDelegate.java :541)
    at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForObject(SqlMapSessionImpl.java:106)
    at org.springframework.orm.ibatis.SqlMapClientTemplate$1.doInSqlMapClient(SqlMapClientTemplate.java:243)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:193)
    at org.springframework.orm.ibatis.SqlMapClientTemplate.queryForObject(SqlMapClientTemplate.java:241)
    at net.bioclipse.structuredb.persistency.dao.GenericDao.getById (GenericDao.java:55)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:296)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint (ReflectiveMethodInvocation.java:177)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
    at net.bioclipse.structuredb.persistency.dao.FetchIntroductionInterceptor.invoke (FetchIntroductionInterceptor.java:36)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)
    at $Proxy6.getById(Unknown Source)
    at net.bioclipse.structuredb.persistency.dao.GenericDaoTest.testUpdate(GenericDaoTest.java:122)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke (Method.java:597)
    at junit.framework.TestCase.runTest(TestCase.java:168)
    at junit.framework.TestCase.runBare(TestCase.java:134)
    at org.springframework.test.ConditionalTestCase.runBare(ConditionalTestCase.java :69)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.access$001(AbstractAnnotationAwareTransactionalTests.java:47)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests$1.run (AbstractAnnotationAwareTransactionalTests.java:115)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTest(AbstractAnnotationAwareTransactionalTests.java:180)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runTestTimed (AbstractAnnotationAwareTransactionalTests.java:153)
    at org.springframework.test.annotation.AbstractAnnotationAwareTransactionalTests.runBare(AbstractAnnotationAwareTransactionalTests.java:111)
    at junit.framework.TestResult$1.protect (TestResult.java:110)
    at junit.framework.TestResult.runProtected(TestResult.java:128)
    at junit.framework.TestResult.run(TestResult.java:113)
    at junit.framework.TestCase.run(TestCase.java:124)
    at junit.framework.TestSuite.runTest(TestSuite.java:232)
    at junit.framework.TestSuite.run(TestSuite.java:227)
    at org.junit.internal.runners.OldTestClassRunner.run(OldTestClassRunner.java:76)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run (JUnit4TestReference.java:38)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main (RemoteTestRunner.java:196)
Caused by: java.lang.RuntimeException: Error setting property 'setStructures' of 'net.bioclipse.structuredb.domain.Library <at> 8f4bee9a'.  Cause: java.lang.IllegalArgumentException : argument type mismatch
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties(PropertyAccessPlan.java:52)
    at com.ibatis.sqlmap.engine.exchange.JavaBeanDataExchange.setData(JavaBeanDataExchange.java :112)
    at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.setResultObjectValues(BasicResultMap.java:373)
    at com.ibatis.sqlmap.engine.mapping.statement.RowHandlerCallback.handleResultObject(RowHandlerCallback.java :64)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:382)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleMultipleResults(SqlExecutor.java:301)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery (SqlExecutor.java:190)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQuery(GeneralStatement.java:205)
    at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryWithCallback (GeneralStatement.java:173)
    ... 45 more
Caused by: java.lang.IllegalArgumentException: argument type mismatch
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.ibatis.sqlmap.engine.accessplan.PropertyAccessPlan.setProperties (PropertyAccessPlan.java:46)
    ... 53 more

What am I doing wrong? Do I need interfaces for my domain objects? I didn't need it when using Hibernate so I thought that maybe... Or what?

--
// Jonathan




--
// Jonathan

Hemant.Kamatgi | 2 Oct 2007 17:13

RE: SQL fired by iBATIS

Hi,

We are using DB2 server and it doesn't have a functionality as 'rownum' in oracle to limit the results.
Hence, we are using iBATIS's ''queryForList(String id,
> Object parameterObject, int skip, int max)' to achieve the same. Does this de-grade the performance very badly?

Rgds
Hemant

-----Original Message-----
From: larry.meadors <at> gmail.com [mailto:larry.meadors <at> gmail.com] On Behalf Of Larry Meadors
Sent: Monday, October 01, 2007 9:16 PM
To: user-java <at> ibatis.apache.org
Subject: Re: SQL fired by iBATIS

The SQL is run exactly as it is in the sql map, but the (skip) results
are skipped, and only (max) rows are mapped to objects.

To answer what I think your question is: The limiting is done in Java,
not in SQL.

There is no SQL standard for limiting the results, so we let you do it
this way (easy, but not terribly efficient), or in your SQL (harder,
but lots more efficient).

Larry

> I want to see the 'SQL' that iBATIS is firing to the Database. We are
> curious to see how the results are fetched for 'queryForList(String id,
> Object parameterObject, int skip, int max)'  method.

Larry Meadors | 2 Oct 2007 17:30
Picon
Favicon

Re: SQL fired by iBATIS

Depends on the driver.

Does it support any "top N" and/or "bottom N" type queries?

If not, and you are looking to improve performance, you may want to
look into using stored procedures to do the limiting.

Larry

On 10/2/07, Hemant. Kamatgi <Hemant.Kamatgi <at> target.com> wrote:
> Hi,
>
> We are using DB2 server and it doesn't have a functionality as 'rownum' in oracle to limit the results.
Hence, we are using iBATIS's ''queryForList(String id,
> > Object parameterObject, int skip, int max)' to achieve the same. Does this de-grade the performance
very badly?
>
> Rgds
> Hemant
>
> -----Original Message-----
> From: larry.meadors <at> gmail.com [mailto:larry.meadors <at> gmail.com] On Behalf Of Larry Meadors
> Sent: Monday, October 01, 2007 9:16 PM
> To: user-java <at> ibatis.apache.org
> Subject: Re: SQL fired by iBATIS
>
> The SQL is run exactly as it is in the sql map, but the (skip) results
> are skipped, and only (max) rows are mapped to objects.
>
> To answer what I think your question is: The limiting is done in Java,
> not in SQL.
>
> There is no SQL standard for limiting the results, so we let you do it
> this way (easy, but not terribly efficient), or in your SQL (harder,
> but lots more efficient).
>
> Larry
>
>
> > I want to see the 'SQL' that iBATIS is firing to the Database. We are
> > curious to see how the results are fetched for 'queryForList(String id,
> > Object parameterObject, int skip, int max)'  method.
>


Gmane