Customizing the SQL Builder Class
Sometimes you might want to add some special treatment for specific types when framework generates JDBC statements for Create, Read, Update or Delete. ADF let you to add your own custom SQL builder class for an application module through jbo.SQLBuilderClass parameter that you configure in bc4j.xcfg file. To do so, you must set jbo.SQLBuilder="Custom" and then specify fully qualified name of your class as parameter to jbo.SQLBuilderClass in bc4j.xcfg file. Hers is an example:
Your SQL builder class needs to be extended from oracle.jbo.server.OracleSQLBuilderImpl or oracle.jbo.server.BaseSQLBuilderImpl(or a fresh implementation of oracle.jbo.server.SQLBuilder interface if you want to start from scratch). Also there should be public static SQLBuilder getInterface() method defined in your class to return a singleton instance of it. Then, you can override the methods of your choice based on use cases. Here is an example:
<AppModuleConfig DeployPlatform="LOCAL"
jbo.project="model.demo.DemoModel" name="AppModuleAMLocal"
ApplicationName="model.demo.AppModuleAM">
<Database
jbo.SQLBuilder="Custom"
jbo.SQLBuilderClass="framework.bc.extension.OracleSQLBuilderImplEx"
jbo.locking.mode="optimistic"/>
<Security AppModuleJndiName="model.demo.AppModuleAM"/>
<Custom JDBCDataSource="java:comp/env/jdbc/HRDS"/>
</AppModuleConfig>
Your SQL builder class needs to be extended from oracle.jbo.server.OracleSQLBuilderImpl or oracle.jbo.server.BaseSQLBuilderImpl(or a fresh implementation of oracle.jbo.server.SQLBuilder interface if you want to start from scratch). Also there should be public static SQLBuilder getInterface() method defined in your class to return a singleton instance of it. Then, you can override the methods of your choice based on use cases. Here is an example:
public class OracleSQLBuilderImplEx extends OracleSQLBuilderImpl {
private static SQLBuilder mSQLBuilderInterface = null;
public OracleSQLBuilderImplEx() {
super();
}
/**
* Gets the singleton instance of this class.
* This is required by the framework in order
* to override the default SQLBuilder
* @return a <tt>SQLBuilder</tt> object.
*/
public static SQLBuilder getInterface() {
if (mSQLBuilderInterface == null) {
if (Diagnostic.isOn()) {
Diagnostic.println("OracleSQLBuilder reached getInterface");
}
mSQLBuilderInterface = (SQLBuilder)(new OracleSQLBuilderImplEx());
if (Diagnostic.isOn()) {
Diagnostic.println(mSQLBuilderInterface.getVersion());
}
}
return mSQLBuilderInterface;
}
//Other methods go here
}
A must read post ......
ReplyDeletegreat job! The author giving the present post, this is very unique and worthy content. I am waiting for your another post...
ReplyDeleteOracle Training in Chennai
Oracle Training institute in chennai
Tableau Training in Chennai
Spark Training in Chennai
Unix Training in Chennai
Power BI Training in Chennai
Oracle DBA Training in Chennai
Oracle Training in Chennai
Oracle Training institute in chennai
ReplyDeleteGreat post. keep sharing such a worthy information
Selenium Training in Chennai
Selenium Training in Bangalore
Selenium Training in Coimbatore
Selenium course in Chennai
Selenium Course in Bangalore
Selenium Course in Coimbatore
Software Testing Course in Chennai
Hacking Course in Bangalore