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 WhyDontYouSlide <wh...@gmail.com> on 2008/06/18 14:16:05 UTC

isPropertyAvailable not working

Hey all,

i'm having somthing like this:

SELECT
   		NUM.COD_COMPAGNIA,
	        NUM.NUM_POLIZZA,
	        NUM.IDE_TELAIO_TARG,
	        NUM.DTA_EFFETTO
FROM    POLIZZA_NUM NUM
		
        LEFT JOIN POLIZZA_CLIENTE POL_CLI
        ON POL_CLI.ID_POLIZZA = NUM.ID_POLIZZA 
   		<dynamic>      
          	<isPropertyAvailable property="filtroPolizza.ricercaCliente">         
				<isNotEmpty prepend="AND"
property="filtroPolizza.ricercaCliente.codCliente">
	            	POL_CLI.COD_CLIENTE =
#filtroPolizza.ricercaCliente.codCliente#   
	        	</isNotEmpty>
				<isNotEmpty prepend="AND" property="filtroPolizza.ricercaCliente.ruolo">
	    			POL_CLI.COD_TIPO_RUOLO = #filtroPolizza.ricercaCliente.ruolo#
    			</isNotEmpty>
	   		</isPropertyAvailable>   
			<isNotPropertyAvailable property="filtroPolizza.ricercaCliente">             
	            AND POL_CLI.FLG_PRINCIPALE = '1' 
				AND POL_CLI.COD_TIPO_RUOLO = '1'
	        </isNotPropertyAvailable>   
	   	</dynamic>  	

problem is that i'm 100% SURE (inspecting in debug mode) that the object 
"filtroPolizza.ricercaCliente" IS NOT NULL and also the subProperty
"getCodCliente" is NOT NULL as well...

and the dynamic tag "isPropertyAvailable" FAIL the test and go for the
"isNOTpropertyAvailable" section instead...

where did I go wrong? cant understand the reason....

I've also tried to swithc from notNull to NotEmpty with no better result
the problem is really on the "jump" of "isPropertyAvailable" which i get
false instead of true..

plz help

WDYS
-- 
View this message in context: http://www.nabble.com/isPropertyAvailable-not-working-tp17981459p17981459.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


Re: isPropertyAvailable not working

Posted by WhyDontYouSlide <wh...@gmail.com>.
Hey all,

after thousands tries i went to the solution...a bit strange

IBATIS seems not supporting java.util.Map and all his children classes as
parameters for apply isPropertyAvailable...

this happens in fact only if u have objects to be tested inside the HashMap.
IBATIS cannot recognize if that object inside the Map is NULL or NOT
PRESENT!

so the best workaround it seems to be to pass the JavaBean instead of the
Map as parameter!!!

parameterClass="it.fondsai.odg.entity.ricerca.polizza.FiltroRicercaPolizza"

while in your DAO Java class u do something like this:

final FiltroRicercaPolizza param = yourObjectHere        //(passed as
parameter)

List<Polizza> polizze = (List<Polizza>)
getSqlMapClientTemplate().execute(new SqlMapClientCallback() {
            public Object doInSqlMapClient(SqlMapExecutor executor) throws
SQLException {
                return executor.queryForList("getDettaglioElencoPolizze",
param);
            }
        });

where param is a JavaBean instead of Map or any implementation of maps!


WhyDontYouSlide wrote:
> 
> Hey all,
> 
> i'm having somthing like this:
> 
> SELECT
>    		NUM.COD_COMPAGNIA,
> 	        NUM.NUM_POLIZZA,
> 	        NUM.IDE_TELAIO_TARG,
> 	        NUM.DTA_EFFETTO
> FROM    POLIZZA_NUM NUM
> 		
>         LEFT JOIN POLIZZA_CLIENTE POL_CLI
>         ON POL_CLI.ID_POLIZZA = NUM.ID_POLIZZA 
>    		<dynamic>      
>           	<isPropertyAvailable property="filtroPolizza.ricercaCliente">         
> 				<isNotEmpty prepend="AND"
> property="filtroPolizza.ricercaCliente.codCliente">
> 	            	POL_CLI.COD_CLIENTE =
> #filtroPolizza.ricercaCliente.codCliente#   
> 	        	</isNotEmpty>
> 				<isNotEmpty prepend="AND"
> property="filtroPolizza.ricercaCliente.ruolo">
> 	    			POL_CLI.COD_TIPO_RUOLO = #filtroPolizza.ricercaCliente.ruolo#
>     			</isNotEmpty>
> 	   		</isPropertyAvailable>   
> 			<isNotPropertyAvailable property="filtroPolizza.ricercaCliente">             
> 	            AND POL_CLI.FLG_PRINCIPALE = '1' 
> 				AND POL_CLI.COD_TIPO_RUOLO = '1'
> 	        </isNotPropertyAvailable>   
> 	   	</dynamic>  	
> 
> problem is that i'm 100% SURE (inspecting in debug mode) that the object 
> "filtroPolizza.ricercaCliente" IS NOT NULL and also the subProperty
> "getCodCliente" is NOT NULL as well...
> 
> and the dynamic tag "isPropertyAvailable" FAIL the test and go for the
> "isNOTpropertyAvailable" section instead...
> 
> where did I go wrong? cant understand the reason....
> 
> I've also tried to swithc from notNull to NotEmpty with no better result
> the problem is really on the "jump" of "isPropertyAvailable" which i get
> false instead of true..
> 
> plz help
> 
> WDYS
> 

-- 
View this message in context: http://www.nabble.com/isPropertyAvailable-not-working-tp17981459p17983701.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.