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 "Farsi, Reza" <Re...@SUNGARD.DE> on 2005/09/13 15:29:24 UTC
Mapping of java char?
Hi all,
I have an object with an attribute of type char.
On the database side, the corresponding table is defindes also as char.
How can I map this attribute? I mapped it as follows:
<result property="positionType" column="position_type"/>
What am I doing wrong? Do I need java.lang.Charachter? If yes, why does
it work with int?
By reading objects the exception below is thrown.
org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
operation; uncategorized SQLException for SQL []; SQL state [null];
error code [0];
--- The error occurred in Position.xml.
--- The error occurred while applying a result map.
--- Check the position.
--- Check the result mapping for the 'positionType' property.
--- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
could be found to map the property 'positionType' to the column
'position_type'. One or both of the types, or the combination of types
is not supported.; nested exception is
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Position.xml.
--- The error occurred while applying a result map.
--- Check the position.
--- Check the result mapping for the 'positionType' property.
--- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
could be found to map the property 'positionType' to the column
'position_type'. One or both of the types, or the combination of types
is not supported.
com.ibatis.common.jdbc.exception.NestedSQLException:
--- The error occurred in Position.xml.
--- The error occurred while applying a result map.
--- Check the position.
--- Check the result mapping for the 'positionType' property.
--- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
could be found to map the property 'positionType' to the column
'position_type'. One or both of the types, or the combination of types
is not supported.
Caused by: com.ibatis.sqlmap.client.SqlMapException: No type handler
could be found to map the property 'positionType' to the column
'position_type'. One or both of the types, or the combination of types
is not supported.
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:188)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
ForList(GeneralStatement.java:123)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:610)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:584)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi
onImpl.java:101)
at
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(S
qlMapClientTemplate.java:245)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClient
Template.java:181)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResul
t(SqlMapClientTemplate.java:204)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapC
lientTemplate.java:243)
at
com.sungard.banking.v3ng.server.dao.ibatis.IbatisPositionDaoImpl.getAll(
IbatisPositionDaoImpl.java:23)
at
com.sungard.banking.v3ng.server.dao.test.TestPositionDao.getAllTest(Test
PositionDao.java:53)
at
com.sungard.banking.v3ng.server.dao.test.ibatis.TestIbatisPositionDao.te
stGetAll(TestIbatisPositionDao.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)
Caused by: com.ibatis.sqlmap.client.SqlMapException: No type handler
could be found to map the property 'positionType' to the column
'position_type'. One or both of the types, or the combination of types
is not supported.
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResul
tMappingValue(BasicResultMap.java:558)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicR
esultMap.java:311)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor
.java:370)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.
java:184)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQu
ery(GeneralStatement.java:205)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:173)
... 24 more
Caused by:
com.ibatis.sqlmap.client.SqlMapException: No type handler could be found
to map the property 'positionType' to the column 'position_type'. One
or both of the types, or the combination of types is not supported.
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResul
tMappingValue(BasicResultMap.java:558)
at
com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicR
esultMap.java:311)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor
.java:370)
at
com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.
java:184)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQu
ery(GeneralStatement.java:205)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
WithCallback(GeneralStatement.java:173)
at
com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
ForList(GeneralStatement.java:123)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:610)
at
com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
ExecutorDelegate.java:584)
at
com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi
onImpl.java:101)
at
org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(S
qlMapClientTemplate.java:245)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClient
Template.java:181)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResul
t(SqlMapClientTemplate.java:204)
at
org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapC
lientTemplate.java:243)
at
com.sungard.banking.v3ng.server.dao.ibatis.IbatisPositionDaoImpl.getAll(
IbatisPositionDaoImpl.java:23)
at
com.sungard.banking.v3ng.server.dao.test.TestPositionDao.getAllTest(Test
PositionDao.java:53)
at
com.sungard.banking.v3ng.server.dao.test.ibatis.TestIbatisPositionDao.te
stGetAll(TestIbatisPositionDao.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
a:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
Impl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
stRunner.java:478)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
ner.java:344)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
nner.java:196)
Regards,
Reza
Re: Mapping of java char?
Posted by Clinton Begin <cb...@codehammer.org>.
JDBC doesn't support char or Character, and therefore iBATIS doesn't either.
I suppose we could transform it to/from a String for input/output
respectfully. All it would need is a type handler
Thoughts?
Cheers,
Clinton
On 9/13/05, Farsi, Reza <Re...@sungard.de> wrote:
>
> Hi all,
>
> I have an object with an attribute of type char.
> On the database side, the corresponding table is defindes also as char.
>
> How can I map this attribute? I mapped it as follows:
> <result property="positionType" column="position_type"/>
>
> What am I doing wrong? Do I need java.lang.Charachter? If yes, why does
> it work with int?
>
> By reading objects the exception below is thrown.
>
> org.springframework.jdbc.UncategorizedSQLException: SqlMapClient
> operation; uncategorized SQLException for SQL []; SQL state [null];
> error code [0];
> --- The error occurred in Position.xml.
> --- The error occurred while applying a result map.
> --- Check the position.
> --- Check the result mapping for the 'positionType' property.
> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
> could be found to map the property 'positionType' to the column
> 'position_type'. One or both of the types, or the combination of types
> is not supported.; nested exception is
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in Position.xml.
> --- The error occurred while applying a result map.
> --- Check the position.
> --- Check the result mapping for the 'positionType' property.
> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
> could be found to map the property 'positionType' to the column
> 'position_type'. One or both of the types, or the combination of types
> is not supported.
> com.ibatis.common.jdbc.exception.NestedSQLException:
> --- The error occurred in Position.xml.
> --- The error occurred while applying a result map.
> --- Check the position.
> --- Check the result mapping for the 'positionType' property.
> --- Cause: com.ibatis.sqlmap.client.SqlMapException: No type handler
> could be found to map the property 'positionType' to the column
> 'position_type'. One or both of the types, or the combination of types
> is not supported.
> Caused by: com.ibatis.sqlmap.client.SqlMapException: No type handler
> could be found to map the property 'positionType' to the column
> 'position_type'. One or both of the types, or the combination of types
> is not supported.
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> WithCallback(GeneralStatement.java:188)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> ForList(GeneralStatement.java:123)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
> ExecutorDelegate.java:610)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
> ExecutorDelegate.java:584)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi
> onImpl.java:101)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(S
> qlMapClientTemplate.java:245)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClient
> Template.java:181)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResul
> t(SqlMapClientTemplate.java:204)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapC
> lientTemplate.java:243)
> at
> com.sungard.banking.v3ng.server.dao.ibatis.IbatisPositionDaoImpl.getAll(
> IbatisPositionDaoImpl.java:23)
> at
> com.sungard.banking.v3ng.server.dao.test.TestPositionDao.getAllTest(Test
> PositionDao.java:53)
> at
> com.sungard.banking.v3ng.server.dao.test.ibatis.TestIbatisPositionDao.te
> stGetAll(TestIbatisPositionDao.java:17)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
> stRunner.java:478)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
> ner.java:344)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
> nner.java:196)
> Caused by: com.ibatis.sqlmap.client.SqlMapException: No type handler
> could be found to map the property 'positionType' to the column
> 'position_type'. One or both of the types, or the combination of types
> is not supported.
> at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResul
> tMappingValue(BasicResultMap.java:558)
> at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicR
> esultMap.java:311)
> at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor
> .java:370)
> at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.
> java:184)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQu
> ery(GeneralStatement.java:205)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> WithCallback(GeneralStatement.java:173)
> ... 24 more
>
> Caused by:
> com.ibatis.sqlmap.client.SqlMapException: No type handler could be found
> to map the property 'positionType' to the column 'position_type'. One
> or both of the types, or the combination of types is not supported.
> at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getPrimitiveResul
> tMappingValue(BasicResultMap.java:558)
> at
> com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicR
> esultMap.java:311)
> at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor
> .java:370)
> at
> com.ibatis.sqlmap.engine.execution.SqlExecutor.executeQuery(SqlExecutor.
> java:184)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.sqlExecuteQu
> ery(GeneralStatement.java:205)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> WithCallback(GeneralStatement.java:173)
> at
> com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery
> ForList(GeneralStatement.java:123)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
> ExecutorDelegate.java:610)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap
> ExecutorDelegate.java:584)
> at
> com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi
> onImpl.java:101)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate$3.doInSqlMapClient(S
> qlMapClientTemplate.java:245)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClient
> Template.java:181)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.executeWithListResul
> t(SqlMapClientTemplate.java:204)
> at
> org.springframework.orm.ibatis.SqlMapClientTemplate.queryForList(SqlMapC
> lientTemplate.java:243)
> at
> com.sungard.banking.v3ng.server.dao.ibatis.IbatisPositionDaoImpl.getAll(
> IbatisPositionDaoImpl.java:23)
> at
> com.sungard.banking.v3ng.server.dao.test.TestPositionDao.getAllTest(Test
> PositionDao.java:53)
> at
> com.sungard.banking.v3ng.server.dao.test.ibatis.TestIbatisPositionDao.te
> stGetAll(TestIbatisPositionDao.java:17)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.jav
> a:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessor
> Impl.java:25)
> at java.lang.reflect.Method.invoke(Method.java:585)
> at junit.framework.TestCase.runTest(TestCase.java:154)
> at junit.framework.TestCase.runBare(TestCase.java:127)
> at junit.framework.TestResult$1.protect(TestResult.java:106)
> at junit.framework.TestResult.runProtected(TestResult.java:124)
> at junit.framework.TestResult.run(TestResult.java:109)
> at junit.framework.TestCase.run(TestCase.java:118)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe
> stRunner.java:478)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun
> ner.java:344)
> at
> org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu
> nner.java:196)
>
>
> Regards,
> Reza
>