Adding Custom Code to a View Object XML File

Pasting a Custom Query in a View Object XML File

If you create your SQL query in a text editor (such as Emacs or vi), the Business Components framework makes it easy to paste it into your XML file:

  1. In the XML file for your View Object, ensure that the CustomQuery attribute for your View Object's <ViewObject...> element is set to "true". That is,

CustomQuery="true"
  1. Enter the following lines in the file:

<SQLQuery><![CDATA[  

  paste your custom SQL here

 ]]></SQLQuery> 

For example:

   ....
<ViewObject
Name="DeptView"
OrderBy="Dept.DNAME"
   CustomQuery="true"
   ComponentClass="package2.DeptViewImpl" >
   <SQLQuery><![CDATA[
SELECT Dept.DEPTNO, Dept.DNAME, Dept.LOC, Dept.FAXNUM
FROM DEPT Dept
   ]]></SQLQuery>
  ...
  1. Save your XML file.

Precautions for Editing the View Object XML File