Return-Path: Delivered-To: apmail-ibatis-user-java-archive@www.apache.org Received: (qmail 94270 invoked from network); 7 Jan 2008 19:41:02 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Jan 2008 19:41:02 -0000 Received: (qmail 9255 invoked by uid 500); 7 Jan 2008 19:40:45 -0000 Delivered-To: apmail-ibatis-user-java-archive@ibatis.apache.org Received: (qmail 9238 invoked by uid 500); 7 Jan 2008 19:40:45 -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 9227 invoked by uid 99); 7 Jan 2008 19:40:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 07 Jan 2008 11:40:44 -0800 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: local policy) Received: from [83.247.21.92] (HELO mail.local.wis.nl) (83.247.21.92) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 07 Jan 2008 19:40:21 +0000 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C85165.177CBB3A" X-MimeOLE: Produced By Microsoft Exchange V6.5.7226.0 Subject: RE: Error setting a property: IllegalArgumentException Date: Mon, 7 Jan 2008 20:40:00 +0100 Message-ID: <50CA25BD6EEA954FA592C097399942E3196CE04C@CM1.wis.local> X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Error setting a property: IllegalArgumentException Thread-Index: AchRUblxaJZjvKvQStaROr2+OGjG5AAEyBCQ From: "Niels Beekman" To: X-Virus-Checked: Checked by ClamAV on apache.org This is a multi-part message in MIME format. ------_=_NextPart_001_01C85165.177CBB3A Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This usually occurs when you are trying to stuff a DB null-value into a primitive Java field. You can either: - change DB data - change primitive type into wrapper, i.e. int -> Integer - use the magic nullValue attribute, personally I don't like this one =20 Niels ________________________________ From: c.zecca@ads.it [mailto:c.zecca@ads.it]=20 Sent: Monday, January 07, 2008 6:14 PM To: user-java@ibatis.apache.org Subject: Error setting a property: IllegalArgumentException =20 Hi all=20 iBatis reports the following exception trace=20 --- The error occurred in it/finmatica/gpj/aa/frontedb/EspressioneFabbricaImpl.xml. =20 --- The error occurred while applying a result map. =20 --- Check the Gpj.mapEspressioneValoriTipoRigaMulti. =20 --- The error happened while setting a property on the result object. =20 --- Cause: com.ibatis.common.exception.NestedRuntimeException: Error setting properties of 'it.finmatica.gpj.ec.istruzioni.EspressioneStruct@75a8152b'. Cause: java.lang.IllegalArgumentException=20 Caused by: java.lang.IllegalArgumentException=20 Caused by: com.ibatis.common.exception.NestedRuntimeException: Error setting properties of 'it.finmatica.gpj.ec.istruzioni.EspressioneStruct@75a8152b'. Cause: java.lang.IllegalArgumentException=20 Caused by: java.lang.IllegalArgumentException=20 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery WithCallback(GeneralStatement.java:188)=20 at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQuery ForList(GeneralStatement.java:123)=20 at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap ExecutorDelegate.java:610)=20 at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlMap ExecutorDelegate.java:584)=20 at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSessi onImpl.java:101)=20 at com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClient Impl.java:78)=20 at it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImpl.getOggettiImpl(Es pressioneFabbricaImpl.java:183)=20 at it.finmatica.gpj.aa.frontedb.InitFogliaFabbricaImpl.getOggettiImpl(InitF ogliaFabbricaImpl.java:119)=20 at it.finmatica.gpj.aa.frontedb.InitFabbricaImpl.getOggetti(InitFabbricaImp l.java:61)=20 at it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImplTest.testGetOggett i(EspressioneFabbricaImplTest.java:87)=20 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)=20 at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)=20 at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)=20 at java.lang.reflect.Method.invoke(Unknown Source)=20 at junit.framework.TestCase.runTest(TestCase.java:164)=20 at junit.framework.TestCase.runBare(TestCase.java:130)=20 at junit.framework.TestResult$1.protect(TestResult.java:110)=20 at junit.framework.TestResult.runProtected(TestResult.java:128)=20 at junit.framework.TestResult.run(TestResult.java:113)=20 at junit.framework.TestCase.run(TestCase.java:120)=20 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTe stRunner.java:478)=20 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRun ner.java:344)=20 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRu nner.java:196)=20 ...=20 Here is the Gpj.mapEspressioneValoriTipoRigaMulti map=20 =20 =20 =20 =20 =20 =20 =20 Is there any way to interpret the (not so well understandable) diagnostic=20 Error setting properties of 'it.finmatica.gpj.ec.istruzioni.EspressioneStruct@75a8152b'.=20 Which property of the EspressioneStruct is involved? Looking to the log I could note what follows:=20 The last prepared stament that has been printed in the log is=20 DEBUG [main] - {pstm-139524} PreparedStatement: select NOME from TIPI_DATO_RIGA where TIPO_RIGA_ID =3D ? =20 DEBUG [main] - {pstm-139524} Parameters: [21]=20 DEBUG [main] - {pstm-139524} Types: [java.math.BigDecimal]=20 That query do correspond to the so called selectNomeCampo query and is used to set the nome property of the EspressioneStruct (see above).=20 =20 The raised exception (java.lang.IllegalArgumentException) would seem indicate a problem with the argument.=20 #id:INTEGER# should be initalized wqith the value of the TIPO_RIGA_ID column, that is decalred as NUMBER(10) ad has value 21 (exactly as reported in the log).=20 Before of that record, dozens of other ones are successfully loaded, exerting well both the nome propperty and its selectNomeCampo setter.=20 Provided that nome and selectNomeCampo actually are the involved entities (I guess so) frankly it would seem everything pretty in order.=20 TIPO_RIGA_ID is a column that is not explicitly assigned to any property, but I saw that this is a quite common practice I'm getting confused.=20 Any suggestion? Thanks in advance=20 ciao=20 Cesare ------_=_NextPart_001_01C85165.177CBB3A Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

This usually occurs when you are = trying to stuff a DB null-value into a primitive Java field. You can = either:

-          change DB data

-          change primitive type into wrapper, i.e. int -> = Integer

-          use the magic nullValue attribute, personally I don’t like this = one

 

Niels


From: = c.zecca@ads.it [mailto:c.zecca@ads.it]
Sent: Monday, January 07, = 2008 6:14 PM
To: = user-java@ibatis.apache.org
Subject: Error setting a = property: IllegalArgumentException

 


Hi all

iBatis reports the following exception trace

--- The error occurred in it/finmatica/gpj/aa/frontedb/EspressioneFabbricaImpl.xml. =  
--- The error occurred while = applying a result map.  
--- Check the Gpj.mapEspressioneValoriTipoRigaMulti.  
--- The error happened while = setting a property on the result object.  
--- Cause: com.ibatis.common.exception.NestedRuntimeException: Error setting properties of 'it.finmatica.gpj.ec.istruzioni.EspressioneStruct@75a8152b'. =  Cause: java.lang.IllegalArgumentException =
Caused by: java.lang.IllegalArgumentException
Caused by: com.ibatis.common.exception.NestedRuntimeException: Error setting properties of 'it.finmatica.gpj.ec.istruzioni.EspressioneStruct@75a8152b'. =  Cause: java.lang.IllegalArgumentException =
Caused by: java.lang.IllegalArgumentException
        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryW= ithCallback(GeneralStatement.java:188)
        at com.ibatis.sqlmap.engine.mapping.statement.GeneralStatement.executeQueryF= orList(GeneralStatement.java:123)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlM= apExecutorDelegate.java:610)
        at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.queryForList(SqlM= apExecutorDelegate.java:584)
        at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.queryForList(SqlMapSes= sionImpl.java:101)
        at = com.ibatis.sqlmap.engine.impl.SqlMapClientImpl.queryForList(SqlMapClie= ntImpl.java:78)
        at it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImpl.getOggettiImpl(= EspressioneFabbricaImpl.java:183)
        at it.finmatica.gpj.aa.frontedb.InitFogliaFabbricaImpl.getOggettiImpl(Ini= tFogliaFabbricaImpl.java:119)
        at it.finmatica.gpj.aa.frontedb.InitFabbricaImpl.getOggetti(InitFabbricaI= mpl.java:61)
        at it.finmatica.gpj.ec.istruzioni.EspressioneFabbricaImplTest.testGetOggetti= (EspressioneFabbricaImplTest.java:87)
        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:164)
        at = junit.framework.TestCase.runBare(TestCase.java:130)
        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:120)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(Remote= TestRunner.java:478)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestR= unner.java:344)
        at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTest= Runner.java:196)
        ...


Here is the Gpj.mapEspressioneValoriTipoRigaMulti map

        <resultMap id=3D"mapEspressioneValoriTipoRigaMulti" class=3D"it.finmatica.gpj.ec.istruzioni.EspressioneStruct"><= /span>
                <result property=3D"id" column=3D"VALORE_ID" jdbcType=3D"NUMERIC" = javaType=3D"int"/>
                <result property=3D"idIdentificatore" select=3D"Gpj.selectIdIdentificatore" = column=3D"FORMULA_ID" javaType=3D"int"/>
                <result property=3D"idPeriodoNormativo" select=3D"Gpj.selectIdPeriodoNormativo" = column=3D"FORMULA_ID" javaType=3D"int"/>
                <result property=3D"idTipo" select=3D"Gpj.selectIdTipoCampo" column=3D"TIPO_RIGA_ID" = javaType=3D"int"/>
                <result property=3D"nome" select=3D"Gpj.selectNomeCampo" column=3D"TIPO_RIGA_ID" = javaType=3D"java.lang.String"/>        
                <result property=3D"testo" column=3D"TESTO" jdbcType=3D"VARCHAR" = javaType=3D"java.lang.String"/>
        </resultMap>


Is there any way to interpret the (not so well understandable) =  diagnostic

Error setting properties of 'it.finmatica.gpj.ec.istruzioni.EspressioneStruct@75a8152b'. =

Which property of the EspressioneStruct is involved? Looking to the log I = could note what follows:

The last prepared stament that has been printed in the log is =

DEBUG [main] - {pstm-139524} PreparedStatement:    select NOME   from TIPI_DATO_RIGA =   where TIPO_RIGA_ID =3D ?  
DEBUG [main] - {pstm-139524} Parameters: [21]
DEBUG [main] - {pstm-139524} Types: [java.math.BigDecimal]

That query do correspond to the so called  selectNomeCampo query and is used to set the nome property of the EspressioneStruct (see above).

        <select id=3D"selectNomeCampo" resultClass=3D"java.lang.String">
                select NOME
                from = TIPI_DATO_RIGA
                where TIPO_RIGA_ID =3D #id:INTEGER#
        </select>

The raised exception =  (java.lang.IllegalArgumentException) would seem indicate a problem with the argument.

#id:INTEGER# should be initalized wqith the value of the TIPO_RIGA_ID column, that is decalred as NUMBER(10) ad has value 21 (exactly as = reported in the log).

Before of that record, dozens of other ones are successfully loaded, exerting = well both the nome propperty and its selectNomeCampo setter. =

Provided that nome and selectNomeCampo actually are the involved entities (I = guess so) frankly it would seem everything pretty in order.
TIPO_RIGA_ID is a column that is not explicitly assigned to any property, but I saw = that this is a quite common practice
I'm getting confused.



Any suggestion?
Thanks in advance


ciao
Cesare

------_=_NextPart_001_01C85165.177CBB3A--