-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: query.executeUpdate() return Value is never 0
PostPosted: Tue Nov 05, 2013 7:21 am 
Beginner
Beginner

Joined: Sat Feb 16, 2008 3:09 pm
Posts: 24
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.