Tuesday, April 5, 2011

Jdeveloper– ADF Project as dependent Library

As the project size goes big ,it is best idea to create multiple sub project based on module.

Here is a step by step example to make your life simple.

Create Main Application

1. Create AppMain App with two view object EmployeeVO , DepartmentVO view object.

2. Create taskflow –> Crete view and drop EmployeeVO as table on page

Create Child App and Deploy as Jar

1. Create AppChildOne App with one view object JobVO view object.

2.Create task flow –> view and drop JobVO as table on page.

3.Create library of AppChildOne to be used in AppMain project.

4. Right click view controller of AppChildOne and click new

image

5.Select ADF Library Jar file and click ok.

6. It will open Edit Library which will show the path where Jar will be stored.

image

7. After doing this , right click the viewcontroller and click project properties and click deployment where it will show you the jar that you recently created and you can use this to edit the lib properties in future.

image

Compressing Jar

8.When you click edit ,  there is one option to compress the jar file that you can use to make your final project size small.

I have used default compression option and it has compress my small jar file from 21 KB to 9 KB that is enormous compression.

image

9.Now deploy this file as jar ,so that we can use this in AppMainProject. Right click viewcontroller and click deploy to adflibAppChildOne1.jar

 

image

Time to Use Dependent JAR

There are many ways to use this jar as library. However one of the best preferred way is as follow.

In Jdeveloper Click

View –> Resource Pallete

In Resource pallete click the above folder on left side of resource pallete and click new –> File System.

Give the path of deploy folder and click test connection.

image

Inside file system prjlib will be created.

Right click the project and click add to project.

image

Now right click viewcontroller of main project and click project properties.

Go to Library and Classpath. Locate  “ADF Library” and click edit.

image

Now you can see dependent project is added as library.

Next step is to go to component pallete.

image

We can see the library in component pallete.

image

We can use this task flow on our page that is coming from library.

Creating second dependent project

Now let us say we have new module requirement and we create new application appmodulechildtwo and create one task flow.

We will follow the same steps as in appchild one except we will point jar option to appchildone deploy folder.

Actually in real case scenario we have to create separate deploy folder at application level where all the jar file will be stored.

So we can create file system in resource pallet it will refer to same folder for all adf lib jar file.

image

Now go back to applicationmain and click add to project for appchildtwo.

image

This will bring the library in component pallete where we can drag and drop task flow from appchildtwo.

image

Finally,I would like to say that how easy it is to manage the structure of project based on library and manage it using jdeveloper ide.

My next blog it to create EAR based on this multiple project library that we can deploy it on server.

Monday, April 4, 2011

Jdeveloper 11g–Auto Clean the project before running

 

When we are developing jdeveloper application based on multiple library dependency , we make a habit of cleaning the project and building it because some time latest task flow are not refreshed properly.

However , Jdeveloper like eclipse provide us auto clean option that is not selected by default.

1. Refresh the main project viewcontroller.jpr or portal.jpr if you are working with webcenter.

image

2.Then select this option which will auto clean the project every time before running.

 

image

Saturday, April 2, 2011

Best trick of programming is to relax - India Won ICC Cricket Worldcup 2011

 

I got relaxed after watching this match and this is surely going to improve my Oracle ADF Technique

Tuesday, March 29, 2011

Customizing Jdeveloper to your need

 

First thing need to be done before any ADF or any other project is to define the project structure , file naming convention , package structure , common business component suffix etc.

Jdeveloper has very nice way of doing all this using Tool –> Prefrences

1.Override the ADF BC impl file.

Most common practive I have seen in last five year of application development using OAF , ADF is to have ViewImpl and EntityImpl , AppmoduleImpl extension for generic requirement.

image

This is place in jdeveloper where we can specify that files.

2.Class naming

This is good naming convention given by oracle for default ,so I am not interested in changing this.

3.Creating new history type

By default when we create Entity Object we can five history type for each attribute in jdeveloper. If we want to create any business specific history type that applies to all entity object , here is the place to go.

image

image

4.Object Naming

I like this feature very much as it simplifies object naming throughout our application.

So when we create ADF BC component it will suffix following characters to the business component name to differentiate between different object type.

image

5.Packages

This is also very nice feature which will place the ADF BC files automatically in corresponding package after doing this setting.

image

6.Extensions

This is nice feature to check what extension is currently installed on your jdeveloper i.e. good during working with webcenter.

image

7.Code Templates

This feature reduce the typing while writing stuff in managed bean or jsf file.

Example :- I have use sop feature too much , so when I write sop and press ctrl enter it write System.out.println.

This is based on following setting

image

So we can have our own custom template for other stuff here.

Here is SQL Editor code template

image

8.CSS Editor

For style sheet person ,this is great feature for selecting CSS style sheet.

one can specify custom too.

image

9.Deployment

You might have noticed while create ear that it save the file in deploy folder inside application. If we want some other folder , here is place to set.

image

10.File Type

When we open jsff or jspx file in jdeveloper ,it open it in design view by default and it take some time to open since it renders the GUI.

To save some time you can set the GUI file to open in source view.

image

11.Short Cut Keys

If we want to define short cut keys for our jdeveloper related daily task then this is way to go.

image

There are many other feature in preference ,however described one is used mostly in most of development places by developer for ease of work.

Resetting Jdeveloper Window Positioning

I have seen sometime I want to go back to old jdeveloper view after messing around jdeveloper and re-arranging lot of development related window.

Simple level of component position back to original can be achieve by going to

Window –> Reset Window to Factory Settings.

image

However  it will not change the sizing of window and few other stuff.

To completely wipe off GUI Setting for jdeveloper go to following directory in

Document Setting or C:/User folder and delete file “windowinglayout.xml” and restart the jdeveloper.

AppData\Roaming\JDeveloper\system11.1.1.4.******\o.ide

Friday, March 25, 2011

ADF Entity Object Synchronize do not work in many cases

 

As you might have noticed that entity object in oracle adf provide you with great feature of synchronizing the entity object. However , synchronize do not work in few cases and I have listed all cases where it work and where it does not.

Synchronize Works

When we alter the table by adding column.

Synchronize Do Not Work

When we drop the column from DB table.

It do not handle change data type like precision change and other.

For this we need to manually change this in EO and any other reference in project using Find Usage feature of jdeveloper.

ADF with DB2 SQL Server Oracle

 

If we want to use one ADF application with multiple database then we have to select SQL92 Flavor when building an application. This makes application portable to both Oracle DB and Non Oracle DB.

Explanation :-

When we create first business component for fusion web application.

Jdeveloper prompt the dialog for database connection that we can choose.

There are two more important selection that are

SQL Flavor

SQL flavor will be use by view objects  to formulate SQL statements. Although the default for an Oracle database connection is always the Oracle SQL flavor, other SQL flavors you can choose include OLite (for the Oracle Lite database), SQLServer for a Microsoft SQLServer database, DB2 for an IBM DB2 database, and SQL92 for any other supported SQL92- compliant database.

image

Once SQL Flavour is selected it cannot be changed later on using project properties, but can be overidden in adf-config.xml overiew.

image

When we overide it adds following lines in adf-config.xml

When Specified database type in the adf-config.xml file supports generating SQL statements during runtime which can require the actual database type

image

image

There is more imporant setting of Type Map that that data model project will use. If JDeveloper detects you are using an Oracle database driver, it defaults the Type Map setting to the Oracle type map and will use the optimized types in the oracle.jbo.domain package.

We can also change to use Java type map.

Also , One cannot change the type map after it is initialized a data model project.