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.
Pinned topic Using Dynamic SQL
2012-03-01T18:24:29Z | mdm-migration
Answered question This question has been answered.
Unanswered question This question has not been answered yet.
Re: Using Dynamic SQL2012-03-02T10:13:28ZThis is the accepted answer. This is the accepted answer.Hi,
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.