Products | Versions |
---|---|
TIBCO BusinessEvents Enterprise Edition | - |
Not Applicable | - |
Resolution:
Description:
==========
When trying to execute a SQL statement with max clause, function Database.queryUsingSQL threw NullPointerException. If max clause was removed, no exception is thrown.
Environment:
==========
TIBCO BusinessEvents - 4.x
OS - All
Symptoms:
=========
1). Using DB Concepts and invoking method " Database.queryUsingSQL".
2). If the SQL statement has MAX function, NullPointerException is generated. If same SQL statement is used without MAX function, it executes successfully.
Cause:
======
Database.queryUsingSQL is a RDBMS function. It queries DB unlike BQL queries which are for querying cache. This function returns a Concept resultset (Concept[]) instead of certain column set. It is not possible to cast the max(column) to a Concept so it throws the NullPointerException.
Resolution:
=========
To get the maximum value of a column, change the SQL statement by adding a max clause in the where clause. This selects the Concepts which has the maximum value of a specific column from the target table.