JBoss 4.2
Code:
@NamedQuery(name="ZahlungDrittempfaenger.updateBankInformation", query="UPDATE ZahlungDrittempfaenger z SET z.iban = :iban, z.bic = :bic WHERE z.bankleitzahl = :blz AND z.kontonummer = :kontonummer")
....
Query query = entityManager.createNamedQuery("ZahlungDrittempfaenger.updateBankInformation");
query.setParameter("bic", bankInformation.getBic());
query.setParameter("iban", bankInformation.getIban());
query.setParameter("blz", bankInformation.getBlz());
query.setParameter("kontonummer", bankInformation.getKontonummer());
int sqlReturn= query.executeUpdate();
if (sqlReturn == 0) {
log.error(bankInformation.toString() + " ...");
}
My problem is that sqlReturn == 0 never evaluates to true, although I can see in database that some of the entries were never updated.
I must react to unsuccessful updates.
From the api doc:
executeUpdate
int executeUpdate()
Execute an update or delete statement.
Returns:
the number of entities updated or deleted