The ideal solution would be to either remove the null-option on the column or to use a wrapper class (i.e. Integer instead of int). If you do not want to make either modifications, you could use the nullValue-attribute which puts a "magic" value into your bean.
Niels -----Original Message----- From: Francisco Exposito Aguilera [mailto:[EMAIL PROTECTED] Sent: woensdag 18 juli 2007 22:29 To: [email protected] Subject: RE: Issue in dynamic select Yes, I know that the value, in this case, is a null. Sometimes the value is null and sometimes the value is not null, it depends and it is right. Then, what I want is obtain and set this value when it is not null and avoid it when it is null. Is there any way to do it? Is it possible? >From: "Niels Beekman" <[EMAIL PROTECTED]> >Reply-To: [email protected] >To: <[email protected]> >Subject: RE: Issue in dynamic select >Date: Wed, 18 Jul 2007 20:52:57 +0200 > >Either you are throwing the exception yourselves from the setter, or you >are trying to map a null value into a primitive field... > >Hope this helps, > >Niels > >-----Original Message----- >From: Francisco Exposito Aguilera [mailto:[EMAIL PROTECTED] >Sent: woensdag 18 juli 2007 17:42 >To: [email protected] >Subject: Issue in dynamic select > >Hello, > >I have a table where the attribute OET_Padre is a FK which sometimes is >null. > >I want to create a dynamic select which show all fields when OET_Padre is >not null and all fields but this one when is null. > >I´ve created a result map: > ><resultMap id="mapElementosTransaccion" >class="ads.orquestador.modelo.Elemento"> > <result property="oetID_" column="OET_ID"/> > <result property="oetItemId_" column="OET_ITEMID"/> > <result property="oetClase_" column="OET_CLASE"/> > <result property="oetVersion_" column="OET_VERSION"/> > <result property="oetOrqId_" column="OET_ORQ_ID"/> > <result property="oetPadre_" column="OET_PADRE"/> ></resultMap> > >and the select: > ><select id="getElementosTransaccion" resultMap="mapElementosTransaccion" >remapResults="true"> > SELECT > OET_ID, > OET_ItemID, > OET_Clase, > OET_Version, > OET_ORQ_ID, > OET_PADRE > FROM ORQ_TRANS, ORQ_ELEM_TMP > WHERE OTR_ID=#oetOrqId_# > >but when the OET_PADRE is null I receive the error > >--- Cause: java.lang.RuntimeException: Error setting property >'setOetPadre_' >of '[EMAIL PROTECTED]'. Cause: >java.lang.IllegalArgumentException > >Can anybody help me? Thanks a lot. > >_________________________________________________________________ >Acepta el reto MSN Premium: Protección para tus hijos en internet. >Descárgalo y pruébalo 2 meses gratis. >http://join.msn.com?XAPID=1697&DI=1055&HL=Footer_mailsenviados_proteccioninfantil > _________________________________________________________________ Grandes éxitos, superhéroes, imitaciones, cine y TV... http://es.msn.kiwee.com/ Lo mejor para tu móvil.
