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 Francisco Exposito Aguilera <fc...@hotmail.com> on 2007/07/18 17:41:30 UTC

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 'ads.orquestador.modelo.Elemento@e7b3f2'.  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


Re: properties file location

Posted by Larry Meadors <lm...@apache.org>.
I don't think so - URLs are absolute, and resources must be on the classpath.

Larry


On 9/12/07, Francisco Exposito Aguilera <fc...@hotmail.com> wrote:
>
>  Hello,
>
>  As I´ve read, there are two options to tell iBatis where is the properties
> resource file:
>
>
>
> <properties
> resource="ads/orquestador/entrada/tabla/ibatis/SqlMapConfig.properties"/>
>
>
>
> <properties url="file:///C:/Archivos de programa/CoCreate/Shared/Model
> Manager 2006/ads/conf/SqlMapConfigEntrada.properties" />
>  Is there any way to tell iBatis a relative path where the file is located?
> Because I will have a jar file and I need to put the SqlMapConfig.properties
> outside the jar and the folder depends.
>
>  Sometimes the jar will go to
>  C:/Archivos de programa/CoCreate/Shared/Model Manager 2006/ads/conf/
>  and sometines in
>  C:/Archivos de programa/CoCreate/Shared/Model Manager 2007/ads/conf/
>
>  and I don´t want to change properties resource every time I create the jar
> file.
>
>  If I try to put
>  <properties
> resource="../../../../../../ads/conf/SqlMapConfig.properties"/>
>
>  when I execute it I receive an IOException with no file found message.
>
>  Thanks a lot.
>
> ________________________________
> Llama a tus amigos de PC a PC: ¡Es GRATIS! Pruébalo

properties file location

Posted by Francisco Exposito Aguilera <fc...@hotmail.com>.
Hello,
 
As I´ve read, there are two options to tell iBatis where is the properties resource file:
 
<properties resource="ads/orquestador/entrada/tabla/ibatis/SqlMapConfig.properties"/>
 
<properties url="file:///C:/Archivos de programa/CoCreate/Shared/Model Manager 2006/ads/conf/SqlMapConfigEntrada.properties" />
 
Is there any way to tell iBatis a relative path where the file is located? Because I will have a jar file and I need to put the SqlMapConfig.properties outside the jar and the folder depends. 
 
Sometimes the jar will go to 
C:/Archivos de programa/CoCreate/Shared/Model Manager 2006/ads/conf/  
and sometines in 
C:/Archivos de programa/CoCreate/Shared/Model Manager 2007/ads/conf/  
 
and I don´t want to change properties resource every time I create the jar file.
 
If I try to put 
<properties resource="../../../../../../ads/conf/SqlMapConfig.properties"/>
 
when I execute it I receive an IOException with no file found message.
 
Thanks a lot.
_________________________________________________________________
Llama a tus amigos de PC a PC: ¡Es GRATIS!
http://get.live.com/messenger/overview