Products | Versions |
---|---|
TIBCO BusinessEvents Enterprise Edition | - |
Not Applicable | - |
Resolution:
Abstract:
===========
How to set the the mapOfParameters for bind variables in Query.Util.executeInDynamicQuerySession(String sqlString, Object mapOfParameters, boolean reuse) call.
Description:
============
When using Query.Util.executeInDynamicQuerySession(), call the 2nd argument is an object which encapsulates the bind variables defined in your query. The argument name is “mapOfParameters”. If your cache query has bind variables you can use this argument to pass the bind variable values to the query at run-time.
Environment:
===========
BE Version : 4.x /5.x
OS: All
Cause:
Resolution:
==========
To use mapofParameters you need to create a Hash Map and put all your bind variables into the hashmap and use the map object in Query.Util.executeInDynamicQuerySession as “mapofparameters”.
Here is a sample that explains this in detail:
String queryString = "Select ec from /Concepts/EmployeeC as ec where ec.empno>$x and ec.age>$y";
Util.HashMap.createMap("bindVars");
Util.HashMap.putObject("bindVars","x",10);
Util.HashMap.putObject("bindVars","y",20);
Object map = Util.HashMap.getMap("bindVars");
Object rows = Query.Util.executeInDynamicQuerySession(queryString, map, true);
Here Hashmap is used to define and populate the bind variables for the query.