There are two methods available to override to implement dynamic query.
Can any one please tell what is the difference between the two?
This topic has been locked.
2 replies Latest Post - 2012-03-23T20:11:34Z by SystemAdmin
Pinned topic Using Dynamic SQL
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Updated on 2012-03-23T20:11:34Z at 2012-03-23T20:11:34Z by SystemAdmin
Re: Using Dynamic SQL2012-03-02T10:13:28Z in response to SystemAdminHi,
If you are writing a BObjQuery class which extends GenericBObjQuery, then you can implement either provideSQLStatement or getSQLStatement to return the required SQL. The SQL returned by provideSQLStatement will be used in preference to the SQL returned by getSQLStatement.
The methods modifySQLStatement and getOrderByStatement are applied to the SQL returned by getSQLStatement, but the default implementations of these methods don't do anything - so practically, for dynamic SQL you can implement either provideSQLStatement or getSQLStatement, the results would be the same.
The default implementation of provideSQLStatement returns null. The default implementation of getSQLStatement retrieves the SQL from the query interface class returned by provideQueryInterfaceClass.
You may find my article on writing custom query transactions helpful: http://www.ibm.com/developerworks/data/tutorials/dm-1111customquerymdm/
Hope that helps, Catherine.