-->
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: Bind Mismatch Issue
PostPosted: Tue Nov 17, 2009 4:32 am 
Newbie

Joined: Tue Nov 17, 2009 4:18 am
Posts: 1
Hi,
I received a mail from our DBA saying that below query always reparsed by Oracle due to “bind mismatch” problem although we are using bind variables.

Code is -

There are 2 types of code which we used to insert data into tables.
Code1 with bind variables -

Code:
String hqlUpdate = "update " + boSource + " a set tibStatus = :loadStatusString where tibStatus = :intermediateStatusString and "+selectMaxOf +" from " + boSource
                    + " where tibStatus = a.tibStatus " + sqlkeyCriteria + ")";
            HashMap hParamMap = new HashMap();
            hParamMap.put("loadStatusString", "LOAD");
            hParamMap.put("intermediateStatusString", "INTR");
            objectPS.executeQuery(hqlUpdate, hParamMap);
            objectPS.flush();


Code2 without bind variables -

Code:
private void logErrorInDB(BOErrorLog objBOErrorLog, String userCode)
      {
            logger.logInfo("logErrorInDB", "Entering the method");
            objBOErrorLog.setCreatedBy(userCode);
            objBOErrorLog.setCreatedOn(new Date());
            objBOErrorLog.setModifiedBy(userCode);
            objBOErrorLog.setModifiedOn(new Date());
            objectPS.saveOrUpdate(objBOErrorLog);
            logger.logInfo("logErrorInDB", "Exiting the method");
      }


generated SQL - Provided by DBA

Code:
insert into ERROR_LOG (OBJECT_CODE, OBJECT_KEY, PROCESS_CODE, ERROR_CODE, DESCRIPTION, CREATED_BY, CREATED_ON, MODIFIED_BY, MODIFIED_ON, id) values (:1, :2, :3, :4, :5, :6, :7, :8, :9, :10);


Please let me know why i am getting bind mismatch with bind variables itself? Or is there any other way to rewrite the above code to get rid of this problem.
Thanks in advance.


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.