I have developed sample application, that shows how to use MDSYS.SDO_GEOMETRY object type in ADF BC applications - ObjectTypeDomain.zip. However, all principles described in this sample, can be applied when using other Oracle Object Types in your applications. Developed sample use standard MVDEMO schema CITIES table, this schema can be downloaded from - Oracle MapViewer Demo Data Set. Model layer is developed using ADF Business Components, in View layer ADF Faces components are used.
When Entity object for CITIES table is created, type for spatial column is generated - SdoGeometry domain. Additionally, SdoPointType domain is generated. SdoPointType is a subdomain for SdoGeometry.
If we will look deeper, and review Java classes generated by Oracle ADF Business Components Design Time, we could find initStructureDef() method in both - SdoGeometry.java and SdoPointType.java. Code in this method represent object type structure. initStructureDef() method code for SdoGeometry domain:
initStructureDef() method code for SdoPointType domain:
There is no any modifications in ADF BC View object and Application Module, everything is created using default properties.
Ok, now we can switch to the View layer and review how users can edit and update data represented by ADF BC domains. Let's start from Data Control Palette - MDSYS.SDO_GEOMETRY object type is included into Data Control, we can explore and use it. Data Control with domain for object type looks like:
Developed sample application contains two pages - cities.jspx and sdoPointEdit.jspx. First page displays attribute cities data, in sdoPointEdit.jspx spatial data for selected city can be updated. Cities table content:
Let's select San Diego city and press 'Edit Geometry' button. Edit form for spatial information (X, Y) is displayed:
For example, we can change Y value to 33.815 and update SanDiego city geographical location ;-).
Ok, how to be sure, and check that spatial data is really updated. I think, we can use good old SQL*Plus and execute a query - 'SELECT C.LOCATION.SDO_POINT.Y FROM CITIES C WHERE C.RANK90 = 6', on CITIES table. Returned result is as we have expected: 33.815. So, operations on Oracle Object Types in ADF BC application can be implemented really easy. SQL*Plus shell window: