'ERRORCODE=-4220, SQLSTATE=22003 on java select from DB2
i'm having the following exception with this method, any guess? The same exception is thrown even if i change the parameters of the function, i also tried with String but the problem is the same.
public void getDettagliLottoPerPersonalizzazione(BigDecimal numeroLotto, BigDecimal progressivoApparato, BigDecimal numeroScatola) throws Exception
{
List<DettaglioLottoPersonalizzazioneDTO> dettaglioLottoResult = null;
Query query = null;
try
{
logger.info("Ricerca dettaglio lotto da personalizzare per numero lotto " + String.valueOf(numeroLotto) );
XmlQueryReader prop = XmlQueryReader.getIstance();
String queryDettaglioLotto = prop.getQuery(this.getClass().getSimpleName(), "queryLetturaDatiPerPersonalizzazione");
query = entityManagerView.createNativeQuery(queryDettaglioLotto);
query.setParameter(1,numeroLotto);
query.setParameter(2,numeroLotto);
query.setParameter(3,numeroLotto);
List<Object[]> result = query.getResultList();
for (Object[] objects: result) {
System.out.println((String)objects[0]);
System.out.println((String)objects[1]);
System.out.println((String)objects[2]);
System.out.println((String)objects[3]);
}
}
catch(Exception e)
{
logger.error("Errore durante la ricerca del dettaglio lotto da personalizzare per numero lotto " + String.valueOf(numeroLotto) + ". " + e.getMessage());
throw new Exception("Errore durante la ricerca del dettaglio lotto da personalizzare per numero lotto " + String.valueOf(numeroLotto));
}
logger.info("Ricerca dettaglio da personalizzare numero " + String.valueOf(numeroLotto) + " avvenuta con successo");
}
Here's the exception
javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse
Persistence Services - 2.7.6.v20200131-b7c997804f): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: com.ibm.db2.jcc.am.SqlDataException: [jcc][t4][1037][11190][4.19.49] An exception occurred during BigDecimal conversion. Refer to the attached Throwable for more details. ERRORCODE=-4220, SQLSTATE=22003
Error Code: -4220
Call:
SELECT a.D_ORD AS data_ordine, a.C_FOR||a.C_OBU_NEW AS codice_apparato, b.C_POS AS postazione_personalizzazione, c.T_ID_POS AS identificativo_postazione
FROM EVDA.TETS3T_INT_SRV A
INNER JOIN EVDA.TETSKI_INT_CON_ORD B ON a.C_CTP_CLI = b.C_CTP_CLI AND a.D_ORD = b.D_ORD
INNER JOIN evda.TETSIL_POS_PER C ON b.C_POS = c.C_POS
WHERE b.N_LOT_PRD = ?
AND a.N_PRG_TIT_PRE = ?
AND b.N_SCA = ?
bind => [3 parameters bound]
Query: DataReadQuery(sql="
SELECT a.D_ORD AS data_ordine, a.C_FOR||a.C_OBU_NEW AS codice_apparato, b.C_POS AS postazione_personalizzazione, c.T_ID_POS AS identificativo_postazione
FROM EVDA.TETS3T_INT_SRV A
INNER JOIN EVDA.TETSKI_INT_CON_ORD B ON a.C_CTP_CLI = b.C_CTP_CLI AND a.D_ORD = b.D_ORD
INNER JOIN evda.TETSIL_POS_PER C ON b.C_POS = c.C_POS
WHERE b.N_LOT_PRD = ?
AND a.N_PRG_TIT_PRE = ?
AND b.N_SCA = ?
")
The same query executed on DBeaver works fine.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
