ibatis-user-java mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ForzaPupi.2" <alberto.fi...@email.it>
Subject [Ibator] Problem with query *byExample
Date Thu, 19 Nov 2009 10:15:23 GMT

Hi,

is it possible that a query run from ibatis doesn't work, and the same
(*hopefully*) query run from my sql client (Squirrel) works??? This happens
only on a particular table, and using a query with an Example class
generated from Ibator.
Now the details...

DDL of the table:

CREATE TABLE BT_PARAMETRI
(
   CF_VENDITORE char(16) NOT NULL,
   CHIAVE char(20) NOT NULL,
   CODICE char(20) NOT NULL,
   VALORE varchar2(200),
   DT_INSERIMENTO date DEFAULT sysdate
);
CREATE UNIQUE INDEX NEMOBT1X ON BT_PARAMETRI
(
  CF_VENDITORE,
  CHIAVE,
  CODICE
);

Java code:
BtParamDAOImpl btpd = new BtParamDAOImpl(sqlMap);
...

BtParamExample paramExample = new BtParamExample();
paramExample.createCriteria()
.andCfVenditoreEqualTo(System.getProperty("cf.eproject"))
.andChiaveEqualTo(System.getProperty("param.code.delete.file.policy"))
.andCodiceEqualTo(parCode)
;
logger.info(btpd.countBtParamByExample(paramExample));

...

The example class, the DAO are ibator-generated.

Now, the log form ibatis:

2009-11-19 11:03:14,002 [main] DEBUG java.sql.Connection  - {conn-100004}
Preparing Statement:           select count(*) from NEMO.BT_PARAMETRI              
where                (                             CF_VENDITORE =            
?         and           CHIAVE =             ?         and           CODICE
=             ?                                                              
)                  
2009-11-19 11:03:14,003 [main] DEBUG java.sql.PreparedStatement  -
{pstm-100005} Executing Statement:           select count(*) from
NEMO.BT_PARAMETRI               where                (                            
CF_VENDITORE =             ?         and           CHIAVE =             ?        
and           CODICE =             ?                                                     
        
)                  
2009-11-19 11:03:14,003 [main] DEBUG java.sql.PreparedStatement  -
{pstm-100005} Parameters: [03595150289, CBI_ESITI, DELETE]
2009-11-19 11:03:14,003 [main] DEBUG java.sql.PreparedStatement  -
{pstm-100005} Types: [java.lang.String, java.lang.String, java.lang.String]
2009-11-19 11:03:14,005 [main] DEBUG java.sql.ResultSet  - {rset-100006}
ResultSet
2009-11-19 11:03:14,006 [main] DEBUG java.sql.ResultSet  - {rset-100006}
Header: [COUNT(*)]
2009-11-19 11:03:14,006 [main] DEBUG java.sql.ResultSet  - {rset-100006}
Result: [0]

NOW, if I execute the following query from Squirrel....

select count(*) from NEMO.BT_PARAMETRI               where                (              
             
CF_VENDITORE =             '03595150289'         and           CHIAVE =            
'CBI_ESITI'         and           CODICE =             'DELETE'                          
                                   
)

I get COUNT(*) = 1!!!

I tried to make similar queries on different tables from the same schema,
and the queries work.... 
How's that possible... any clue?

Thanks!
-- 
View this message in context: http://old.nabble.com/-Ibator--Problem-with-query-*byExample-tp26421257p26421257.html
Sent from the iBATIS - User - Java mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-java-unsubscribe@ibatis.apache.org
For additional commands, e-mail: user-java-help@ibatis.apache.org


Mime
View raw message