Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 96686 invoked from network); 11 Sep 2007 09:36:12 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 11 Sep 2007 09:36:12 -0000 Received: (qmail 55086 invoked by uid 500); 11 Sep 2007 09:36:00 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 55077 invoked by uid 500); 11 Sep 2007 09:36:00 -0000 Mailing-List: contact user-java-help@ibatis.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user-java@ibatis.apache.org Delivered-To: mailing list user-java@ibatis.apache.org Received: (qmail 55065 invoked by uid 99); 11 Sep 2007 09:36:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 02:36:00 -0700 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jonathan.alvarsson@gmail.com designates 209.85.198.186 as permitted sender) Received: from [209.85.198.186] (HELO rv-out-0910.google.com) (209.85.198.186) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 11 Sep 2007 09:35:55 +0000 Received: by rv-out-0910.google.com with SMTP id c27so1203486rvf for ; Tue, 11 Sep 2007 02:35:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=SK0HsO3VLeATbzpCetLeq2E23sOUm41VA+jDns0gnwU=; b=Y/K2Iae44iVtY5m0HFI09dhljrneSfjv3whgD/kKuMHeBFKsNoV+hnQEzOZ1xCw/zvsS0fCUWlZz+zNjEJWZb8KcF/l4KEIhdcsPb0aUu3WjyLA0BNdVj0PUTaIVnkDt6/+mNsRzI9G7vJ4r1/FkpeMtMbAaOhdpfvW8uAa0IYc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Pwv4qV3rGk28IJwwaeuLpjaQG+po732jMAYCMOKRazhYjbM9f165zb7sevcVhF+EbnZjlTDE6UeuHTF1rhH/uX1VRK4/cDNNja2wIeMhUDkLVhdjxa5YuO5t3gXWJOKhfDG6V9REtckuPsWpDgWSn1F/Ky/Ea+O/Vs8DBAM1dGE= Received: by 10.141.196.13 with SMTP id y13mr1128277rvp.1189503333868; Tue, 11 Sep 2007 02:35:33 -0700 (PDT) Received: by 10.141.153.15 with HTTP; Tue, 11 Sep 2007 02:35:33 -0700 (PDT) Message-ID: Date: Tue, 11 Sep 2007 11:35:33 +0200 From: "Jonathan Alvarsson" To: user-java@ibatis.apache.org Subject: How to map a list of double? MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_9750_22460503.1189503333846" X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_9750_22460503.1189503333846 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I am trying to map a list of doubles in my bean but I keep getting a ClassCastException on it. CREATE TABLE DescriptorValue ( id BIGINT AUTO_INCREMENT NOT NULL, value DOUBLE NOT NULL, arrayPos INT NOT NULL, abstractDescriptor VARCHAR(36) NOT NULL, PRIMARY KEY (id), FOREIGN KEY (abstractDescriptor) REFERENCES AbstractDescriptor(id) ) ENGINE=InnoDB; How can I do this? Oh and the exception I get: org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0]; --- The error occurred in mapping/MoleculeDescriptor.xml. --- The error occurred while applying a result map. --- Check the MoleculeDescriptor. --- Check the result mapping for the 'values' property. --- Cause: java.lang.ClassCastException: [D; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in mapping/MoleculeDescriptor.xml. --- The error occurred while applying a result map. --- Check the MoleculeDescriptor. --- Check the result mapping for the 'values' property. --- Cause: java.lang.ClassCastException: [D Caused by: com.ibatis.common.jdbc.exception.NestedSQLException: --- The error occurred in mapping/MoleculeDescriptor.xml. --- The error occurred while applying a result map. --- Check the MoleculeDescriptor. --- Check the result mapping for the 'values' property. --- Cause: java.lang.ClassCastException: [D 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.pcm.dao.GenericDao.getById(GenericDao.java:45) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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.pcm.dao.FetchIntroductionInterceptor.invoke( FetchIntroductionInterceptor.java:22) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed( ReflectiveMethodInvocation.java:166) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke( JdkDynamicAopProxy.java:204) at $Proxy0.getById(Unknown Source) at net.bioclipse.pcm.dao.GenericDaoTest.testGetById(GenericDaoTest.java :69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) 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.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run( JUnit3TestReference.java:130) 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.ClassCastException: [D at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.listToArray( ResultLoader.java:85) at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult (ResultLoader.java:75) at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult( ResultLoader.java:59) at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue (BasicResultMap.java:502) at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults( BasicResultMap.java:340) at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults( SqlExecutor.java:381) 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) ... 44 more -- // Jonathan ------=_Part_9750_22460503.1189503333846 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I am trying to map a list of doubles in my bean but I keep getting a ClassCastException on it.

<resultMap class="MoleculeDescriptor" id="MoleculeDescriptor">
        <result property="id"     column="id"   />
        <result property="name"   column="name" />
        <result property="values" column="id" select="MoleculeDescriptor.getValueList" />
</resultMap>

<select id="MoleculeDescriptor.getValueList " resultClass="List" parameterClass="String">
        SELECT
            value AS value
        FROM
            DescriptorValue
        WHERE
            abstractDescriptor=#value#
        ORDER BY
            arrayPos
</select>

CREATE TABLE DescriptorValue (
    id       BIGINT AUTO_INCREMENT NOT NULL,
    value    DOUBLE                NOT NULL,
    arrayPos INT                   NOT NULL,
    abstractDescriptor VARCHAR(36) NOT NULL,

    PRIMARY KEY (id),
    FOREIGN KEY (abstractDescriptor) REFERENCES AbstractDescriptor(id)
) ENGINE=InnoDB;

How can I do this?

Oh and the exception I get:

org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];  
--- The error occurred in mapping/MoleculeDescriptor.xml. 
--- The error occurred while applying a result map. 
--- Check the MoleculeDescriptor. 
--- Check the result mapping for the 'values' property. 
--- Cause: java.lang.ClassCastException: [D; nested exception is com.ibatis.common.jdbc.exception.NestedSQLException:  
--- The error occurred in mapping/MoleculeDescriptor.xml. 
--- The error occurred while applying a result map. 
--- Check the MoleculeDescriptor. 
--- Check the result mapping for the 'values' property. 
--- Cause: java.lang.ClassCastException: [D
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException :  
--- The error occurred in mapping/MoleculeDescriptor.xml. 
--- The error occurred while applying a result map. 
--- Check the MoleculeDescriptor. 
--- Check the result mapping for the 'values' property. 
--- Cause: java.lang.ClassCastException: [D
    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.pcm.dao.GenericDao.getById (GenericDao.java:45)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.pcm.dao.FetchIntroductionInterceptor.invoke (FetchIntroductionInterceptor.java:22)
    at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:166)
    at org.springframework.aop.framework.JdkDynamicAopProxy.invoke (JdkDynamicAopProxy.java:204)
    at $Proxy0.getById(Unknown Source)
    at net.bioclipse.pcm.dao.GenericDaoTest.testGetById(GenericDaoTest.java:69)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run (JUnit3TestReference.java:130)
    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.ClassCastException: [D
    at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.listToArray(ResultLoader.java:85)
    at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.getResult (ResultLoader.java:75)
    at com.ibatis.sqlmap.engine.mapping.result.loader.ResultLoader.loadResult(ResultLoader.java:59)
    at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getNestedSelectMappingValue(BasicResultMap.java :502)
    at com.ibatis.sqlmap.engine.mapping.result.BasicResultMap.getResults(BasicResultMap.java:340)
    at com.ibatis.sqlmap.engine.execution.SqlExecutor.handleResults(SqlExecutor.java:381)
    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)
    ... 44 more



--
// Jonathan ------=_Part_9750_22460503.1189503333846--