Requete qui marche une fois mais pas deux
Bonjour,
Voila mon code
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
|
public Integer getNumberOperationByCriteria(Integer status, Integer category, CalendarDate accountingDate, Set profitCenterSet) throws ApisTechnicalException {
String date = accountingDate.toString(ApisCoreConstants.databaseDatePattern);
Integer result = null;
try {
Query query = getPersistenceManager().getNamedQuery(Prrt.QUERY_GET_NUMBER_OPERATION_BY_CRITERIA);
query.setString("status", String.valueOf(status));
query.setString("category", String.valueOf(category));
query.setInteger("date", Integer.valueOf(date).intValue());
query.setString("profitCenter", buildString(profitCenterSet));
result = (Integer) query.uniqueResult();
getPersistenceManager().flush();
} catch (HibernateException e) {
e.printStackTrace();
throw new ApisTechnicalException("TECHNICAL_EXCEPTION", null, e);
}
return result;
} |
voila ma requete nommé dans mon fichier hbm:
Code:
1 2 3 4 5 6 7 8 9 10 11
|
<query name="PRRT.get_number_operation_by_criteria">
<![CDATA[
select count(prrt)
from Prrt prrt
where prrt.prrtStus like :status
and prrt.prrtCatgoper like :category
and prrt.prrtDateacnt = :date
and prrt.prrtRcen IN (:profitCenter)
]]>
</query> |
Cette fonction est appelé par une boucle, la premiere fois où je l'appelle tout se passe bien mais à la deuxieme j'ai le message suivant:
23/01/07 11:24:55:024 CET] 6140614 JDBCException W org.hibernate.util.JDBCExceptionReporter SQL Error: 1722, SQLState: 42000
[23/01/07 11:24:55:087 CET] 6140614 JDBCException E org.hibernate.util.JDBCExceptionReporter ORA-01722: invalid number
org.hibernate.exception.GenericJDBCException: could not execute query
at java.lang.Throwable.<init>(Throwable.java)
at java.lang.Throwable.<init>(Throwable.java)
at org.hibernate.exception.NestableRuntimeException.<init>(NestableRuntimeException.java:124)
at org.hibernate.JDBCException.<init>(JDBCException.java:20)
at org.hibernate.JDBCException.<init>(JDBCException.java:25)
at org.hibernate.exception.ErrorCodeConverter.handledNonSpecificException(ErrorCodeConverter.java:92)
at org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:80)
at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
at org.hibernate.loader.Loader.doList(Loader.java:1596)
at org.hibernate.loader.Loader.list(Loader.java:1577)
at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
at org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:603)
at ............
Caused by: java.sql.SQLException: ORA-01722: invalid number
J'ai pris la requete sql généré par hibernate:
Code:
select count(prrt0_.PRRT_OPRF) as col_0_0_ from PRRT prrt0_ where (prrt0_.PRRT_STUS like ?) and (prrt0_.PRRT_CATGOPER like ?) and prrt0_.PRRT_DATEACNT=? and (prrt0_.PRRT_RCEN in (?))
En debug j'ai recupéré les valeurs de chaque parametre et j'ai pu execute ma requete sql dans toad sans probleme.
Je comprends vraiment pas d'où viens le probleme.