Products | Versions |
---|---|
TIBCO BusinessEvents Enterprise Edition | 6.x |
TIBCO BusinessEvents now supports native queries, a native query is a typical query that can be executed using any sql client against the cache. For instance for IGNITE cache , if the query works in a sql client against the space from SQL line or DBeaver or other thin client then we can use it in BE. A native BQL query is faster than a normal BQL query, but users need to work with the result set differently.
select <field> from <entityURL> as <alias> where <alias>.<field>=<value> ...
select c@id from /Concepts/DemoConcept as c where c.prop_string="testValue"
"native-query: select <field> from be_gen_<entityURLSeparator_underline> where <field>=<value> ...
e.g.,
"native-query: select _id from be_gen_DemoConcept where prop_string="testValue"
try{
String sQuery = "native-query: select _EXTID from be_gen_concepts_cpTest cp where cp.p1='t2'";
Object oResultList = Query.Util.executeInDynamicQuerySession(sQuery,null,false);
Object[] oRows = Query.Util.listToArray(oResultList);
Query.Util.clearList(oResultList);
for (int i = 0; i < oRows@length; i++){
String sExtID=oRows[i];
// load concept into Rete
Concepts.cpTest cp=Cluster.DataGrid.CacheLoadConceptByExtIdByUri(sExtID,false,"/Concepts/cpTest");
System.debugOut(Engine.ruleFunctionName() + " loaded concept with extID=" + sExtID);
}
}
catch (Exception ex) {
System.debugOut("### ERROR " + Engine.ruleFunctionName() + ": Stacktrace: " + ex@stackTrace);
}