Tuesday, February 26, 2008

Oracle SOA Suite 11g Technology Preview - Configuration Hint

I was recently configuring Oracle SOA Suite 11g on my computer and I have faced configuration related problem. Want to describe it and give hint how not to face it.

Problem description:

1. SOA Suite configuration is failing with message - Configuring SOA Infrastructure has FAILED

2. In startsoa.log there are only two strange lines printed:

Exception in thread "main"

And no more information about problem :-)

Ok, I have found solution in Release Notes for SOA Suite 11g Technology Preview 3 update 1. It seems problem was in spaces in JDEV_USER_DIR path. In order to change home directory you need to open \jdev\bin\jdev.boot file and change value for ide.user.dir variable.

After those changes, I configured Oracle SOA Suite 11g Technology Preview successfully.

Complete Guide for Oracle SOA Suite 11g Technology Preview configuration you can get on OTN.

Thursday, February 21, 2008

Oracle Maps in JDeveloper 11g - Even More Simple

With JDeveloper 11g we have standard support for Databound Geographic Maps. This means we don't need anymore to be GIS (Geographic Information System) specialists to enable Location-Based functionality in our enterprise applications. It sounds cool? Yes, but also it works :). It took for me 10 minutes (or little bit more) to develop sample application for this blog post.

Before I will start to describe implemented application, let's remember little bit how it was in JDeveloper 10g. You can check my older blog post - JavaScript in ADF Faces - Oracle Maps. It was easy as well, but it wasn't so elegant as it is now. In JDeveloper 11g you don't need to care about JavaScript or Oracle Maps API, it's because you don't need to develop - just use provided components. And most important, there is no need to deploy developed application on the same OC4J, where Oracle MapViewer is deployed.

You can download developed application - OraMapsSimple11.zip and run it directly from JDeveloper 11g TP3. Base map in this sample is retrieved from open Oracle service - http://elocation.oracle.com/mapviewer, so in order to run application you need to have Internet connection. In this sample I'm using Customers point theme, data for this theme is retrieved from MVDEMO datasource. You can download this datasource from Oracle MapViewer page on OTN.

When I was developing sample application, I discovered that MDSYS.SDO_GEOMETRY object type is not supported yet by map component in current JDeveloper 11g Technology Preview. But no matter of this I wanted to use point theme from my database, so I applied workaround. Workaround is to add two read-only attributes for X and Y coordinates:

As you can notice, I'm accessing information from spatial column directly - using LOCATION.SDO_POINT.X and LOCATION.SDO_POINT.Y definition.

I have generated map area in View layer using steps described in section 25.6 Creating Databound Geographic Maps from Oracle Fusion Middleware Fusion Developer's Guide for Oracle Application Development Framework 11g Release 1. To add point theme to the map, it's needed only to provide required values and click Ok:

If you will not be lazy to run developed sample application, you will notice how cool are Oracle Maps in JDeveloper 11g. To run this application, you need to open it in JDeveloper 11g TP3 and select Run for main.jspx page, you will get similar view:

All functionality available in this screen, comes with standard component in JDeveloper 11g, you don't need to develop it, you can just use it:

Thursday, February 14, 2008

ADF Business Components: Complex Insert in Easy Way

In this post I continue series of my posts related to DML (Data Manipulation Language) in ADF Business Components, those posts are among of most popular on my blog. I'm writing this post and have developed sample application based on comment i received from one blog reader of Create, Edit and Delete operations in Master-Detail af:table components post. Reader was asking me about how during Insert operation to insert data into second table, table that is not referenced through binding in View layer. Yes, it's possible to put custom method in application module and do insert from Java code, however this will broke declarative approach for Create action in main table.

You can download sample application - ComplexInsert.zip, this application implements declarative approach to Insert new row into Locations table and triggers Insert into Departments table. To run this sample you need to have Oracle XE database installed with HR schema. Application is developed with JDeveloper production release.

First let's look into Model part. Application is based on two Entity objects and one View object. LocationsView is exposed to View layer where new row is created in declarative way.

New Location is created with CreateInsert action defined in mainPageDef.xml Page Definition file:

And let's say we have requirement to create default Department for newly created Location. How to achieve this and not to broke declarative approach we have already implemented for Locations? My answer - with ADF BC you can do this in easy way, simply you can use doDML(...) method in Entity object.

In order to be able to use doDML(...) method, with Entity Object Editor generate Entity Object Class and select Data Manipulation Methods option as well:

Entity Object Class is generated and can be accessed from Structure window:

In generated doDML(...) method I have implemented custom code to insert new row into Departments entity with some default data. This code is executed only during Insert DML operation. This allow to insert data programmatically into separate table based on executed declarative Create action:

To make it even more clear, I will show how it works. User creates new Location from Web UI and press Save button - new row is inserted into LOCATIONS table in database:

Based on this insert, default department for newly created location should be generated. We can check this in database. Oracle SQLDeveloper shows that new row is inserted into LOCATIONS table:

That correct, but what about DEPARTMENTS table? We can check it, and here we have new row inserted for newly created Location:

When running sample application, don't forget to add adf-faces-impl.jar and jsf-impl.jar to application's WEB-INF\lib directory.

Wednesday, February 6, 2008

List-Of-Values Component in Search and Edit Form

Sample application described in this post contains high practical value, it implements real use case. Defined use case - based on value selected in List-Of-Values (LOV) component, perform query in database and display results in form. Form with results is updated, when value in LOV is changed.

You can download developed application - LOVSearchEdit.zip and run it in JDeveloper 11g TP3, additionally you need to have Oracle XE database with HR schema.

Model part of sample application contains Locations Entity object and two View objects - LocationsView and CountriesLovView. First View object is based on Entity object and second View object is read-only, is used in LOV component.

View object - LocationsView is used to query database and return results displayed in form. In other words, this View object perform Search action. LocationsView contains WHERE clause with bind variable, it retrieves Locations by specified Country Id:

In View layer of our application, Search action is initialized by LOV component for Countries. I have created this LOV component as unbounded and not related to Model. I achieved this, by declaring countryIdVar variable in Page Definition, and using this variable as Base Data Source for LOV component.

You can create unbounded LOV component in JSPX page, by dropping empty af:inputListOfValues from ADF Faces Common Components palette. As next step, right-click on newly created component and select from menu - Bind to ADF Control. In Edit List Binding dialog you should choose variables as Base Data Source and in List Data Source choose View object that you want to use as list data provider. For example, in my application this dialog looks like this:

To execute Search action, I'm using ExecuteWithParams action defined in Page Definition and associated with LocationView. Input parameter for bind variable is retrieved directly from attribute wired with LOV component Base Data Source variable.

Defined ExecuteWithParams action is invoked from countryIdReturnPopupListener created for Countries LOV:

And finally last step, in order to refresh form with displayed Search results, you need to put AutoSubmit=true for Countries LOV component. And change PartialTriggers property of form with results to point to Countries LOV Id.

And yes, all this stuff really works. When page is opened and there still no value in LOV is selected, empty form is not displayed:

Let's select any value in LOV component:

Search results are retrieved and form with data is opened. User can navigate through results and update locations from selected country:

Saturday, February 2, 2008

ODTUG Kaleidoscope '08 - Abstracts Posted

Conference abstracts are posted, you can check - ODTUG Kaleidoscope '08.

This year ODTUG Kaleidoscope will cover eight main topics:
  • Fusion Middleware
  • Business Intelligence
  • Methodology
  • Oracle Tools
  • Professional Development
  • Third-Party Tools
  • Java EE and SOA
  • Development DBA
My presentation is under Fusion Middleware branch - Development with Oracle JDeveloper/ADF 11g Reusing 10g Best Practices. As you can see from posted abstract, I will talk about development strategies in JDeveloper/ADF 11g and will develop real demo sample application. Topics that I will cover - new ADF BC features, ADF Task Flows, Templating, ADF Faces Rich Client.

I'll post detail information about my presentation, more close to the event.