Disclaimer

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.
Showing posts with label ORACLE. Show all posts
Showing posts with label ORACLE. Show all posts

Wednesday, February 10, 2010

Ninja ADF Developer

Found an interesting video on oracle ADF




Thursday, December 31, 2009

Deploying ADF 11g application in weblogic 10.3

Today, I was trying to deploy my ADF 11g web application to a weblogic server. So the first step was to right click on View Controller project and go to deploy option. This created a war file for me as npe.war . I went to weblogic console and in the deployments choose install option and provided the path of npe.war. After few next next and finish I saw an error saying:

java.lang.ClassNotFoundException: oracle.adf.library.webapp.ResourceServlet

So, on hunting for a solution finally found that I used the wrong way of deployment. Instead of deploying View-Controller project as a war file I should have deployed the whole application as an ear file. So to do so there is an application menu in the jdeveloper. Select deploy option from there and choose deploy to ear file. So far so good I went again to the weblogic console deleted the old npe.war web app and this time installed npe.ear. After reaching the finish step on hitting finish I saw a new set of errors saying:

java.security.PrivilegedActionException: wenlogic.common.ResourceException:
java.security.PrivilegedActionException: wenlogic.common.ResourceException:
No credential mapper entry found for password indirection user=system for data source NPE

So, another hunt on web resulted into another change I need to do before deploying the app as an ear. To avoid this error you need to go to Application --> Application properties and in the new window uncheck Auto Generate and synchronize weblogic-jdbc.xml Descriptors during deployment.

That's it.. now deploying the ear this time should successful. Please comment if you found any other issues while deploying your ADF application to weblogic.

Wednesday, August 19, 2009

Using Parent Action in ADF 11g

What is parent action and why do we need it?

Imagine a situation where you are on a page and you have dropped a bounded task flow A as a region on this page. Now, from inside TF A you call another bounded task flow TF B which in turns calling a third bounded TF C. So, finally you are in task flow TF C.

Here, there are situations when you may need to navigate directly to TF-A rather to TF-B. So, in this case a task flow return activity will not help as it will only navigate you to the taskflow TF-B.

So, to go to TF-A you can drop a parent Action activity from component pallet on the task flow diagram of TF-C. In the properties define the parent outcome as some string value.

Now in the TF-B drop a task flow return activity and have a control flow navigation from your view activity to the task flow return activity. Give the name to this rule same as the parent outcome name you provided in TF-C.

That's it. Now, when you will will navigate from TF-C the flow will directly navigate to TF-A and skipping the TF-B.

Saturday, August 15, 2009

Programmatic error message in ADF 11g

There are situations when you may need to show error messages from your managed bean code to your ADF page.

ADF 11g supports two level of messages as component level messages and page level messages.

To show a component level message write the following code in your managed bean method:

FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "this is component level message");
FacesContext context = FacesContext.getCurrentInstance();
context.addMessage(.getClientId(context), msg);

Also note that you need to add component to your page (anywhere).

To show page level message you need to use following code:

FacesContext context = FacesContext.getCurrentInstance();
FacesMessage msg = new FacesMessage(FacesMessage.SEVERITY_ERROR, null, "Value entered is invalid");
context.addMessage(null, msg);

Wednesday, August 12, 2009

Using Groovy to populate sequence value in primary key attribute in ADF 11g

In ADF 11g there is a better and much simpler way to populated primary key attribute of your entity using a db sequence.

You can simply to to your entity pk attribute change the default value type to expression and put

(new oracle.jbo.server.SequenceImpl("YOUR_SEQ_NAME",object.getDBTransaction())).getSequenceNumber()

and

Monday, August 10, 2009

What is DataBindings.cpx file in ADF

In ADF web application as soon as you drop a databound component on your page a DataBindigs.cpx file gets created. You may wonder what it contains? So, here it is:

The DataBindings.cpx keeps track of the individual page definitions files used within the project, as well as the DataControls mapping to such things as ADF Business Components Application Modules.

Till Jdeveloper 10.1.3 release there was no way to have multiple DataBindings.cpx files which was very much desirable as the project the size grows and being worked by multiple teams. Jdeveloper 11g added this capability to have multiple DataBindings.cpx files.

There is a new file in 11g called adfm.xml which is used to keep track of all such DataBindings.cpx files in the system. So, when breaking your DataBindings.cpx you need to take care to create an entry in the adfm.xml. You also need to make sure to have unique application id attribute value for each entry.

Usage of PostChanges in ADF

You can override postChanges method of any entity object in your ADF application. postChanges method can be used to push the middle-tier changes to the database. But it does not commit it.

So, a natural question arises like why do we need to push the changes to database from middle-tier and without committing?

Imagine a scenarios where you have a PL/SQL procedure which you need to run after some rows has been inserted/modified in your application. Before you issue a commit everything will remain in the middle-tier. A PL/SQL procedure will run on the database and hence in such scenario your PL/SQL procedure will not be able to get the latest changes which are available in the middle-tier.

So, here comes the postChanges method which you can use to push the middle-tier changes to the database without actually committing.

Thursday, July 23, 2009

Blog on Innovation

Yet another coverage at oracle blogs: http://blogs.oracle.com/innovation/2009/07/innovation_in_your_daytoday_wo.html

Thursday, July 9, 2009

Innovator award

Just thought to post about the Innovator's award at: http://www.oracle.com/innovation/innovator-vivek-kumar.html

Tuesday, June 30, 2009

Innovation in Your Day-to-Day Work

Most of the dictionaries define innovation as a new way of doing something. It’s also defined as an incremental, radical, or revolutionary change in products, processes or organizations. However, bringing that mindset to your day-to-day work is something that needs a lot of courage, time, dedication, and support (from your superiors as well as from peers). Work can become boring over a period of time if nothing changes. On day one it may be too complex to even understand what all it is about. But on the fifth or tenth day it becomes manageable--then comes the day when you feel the job is taking you nowhere. This is what happens to more than 99% of the people doing same or similar work every day. The other 1% are able to avoid that boredom by trying to do their work differently or looking for the ways to do it faster or more efficiently. That mindset, that determination to kill the boredom from everyday life, is another kind of innovation.
Everyone wants his work to be interesting and most people want it to be challenging as well. Nobody wants boring work that never changes. Still, most people fail to be innovative. What does it take to be innovative?
• Willingness to look for new ways of doing your job
• The ability to manage work pressure so that you can analyze what is happening with your job and what needs to change.
• Support and encouragement from your supervisor and peers.
As soon as a process or a work methodology becomes an everyday job without any significant changes, then it is probably a good time to start thinking about bringing
innovation into the job. I believe it is good to be selfish in this regard. If innovation happens, then anyone can generalize it for the betterment of the organization. Not everyone may be innovative but they can be very good watchmen. If someone dares to try a new way of doing something and if it works, no one hesitates to start doing it the same way immediately.
Further, I believe innovation cannot come in isolation. In other words, you cannot set up a group of 10 people in the organization to bring innovation into the system. A dedicated group can facilitate or focus on innovative people but cannot bring all the positive changes that the system may need. Innovation needs real people working on real problems in their day-to-day work and identifying the areas that need a different treatment. So, an organization that believes in innovation must make sure to identify innovative people and nurture them in the organization irrespective of the employees’ type of work and role.

Friday, May 29, 2009

Difference between unique and non unique index

For a unique index, there is one rowid per data value.
For a nonunique index, the rowid is included in the key in sorted order, so nonunique indexes are sorted by the index key and rowid. Key values containing all nulls are not indexed, except for cluster indexes. Two rows can both contain all nulls and not violate a unique index.

Key compression cannot be used in a unique index with a single-attribute key.

Monday, April 6, 2009

Jdeveloper update available for 11g

You can grab a new release of jdeveloper 11g from http://www.oracle.com/technology/software/products/jdev/htdocs/soft11.html it contains a lot of bug fixex which are available at http://www.oracle.com/technology/products/jdev/htdocs/11/111102fixlist.html

Sunday, March 22, 2009

Generating Resource Bundles in ADF applications

Edwin Biemond posted about generating resource bundles in ADF applications. In brief resource bundles is way to support localization of applications. Read more at:http://biemond.blogspot.com/2009/03/generate-resource-bundles-for-adf.html

Sunday, March 8, 2009

Firing direct SQL using Application Module in ADF

There are times when you may need to fire a sql query like for a table clean up in ADF. For that you may not like to create a VO and doing all that standard stuff for your too simple requirement.

Other scenario is you may not have the access to the AM directly to which an entity belongs to. So, in that case you will not be able to use the VOs belonging to the AM for your requirements.

In such cases you can use the following code:
        try{
        FacesContext facesContext = FacesContext.getCurrentInstance();
        ExpressionFactory exp = facesContext.getApplication().getExpressionFactory();
        DCBindingContainer bindingContainer = (DCBindingContainer)exp.createValueExpression(facesContext.getELContext(),"#{bindings}",DCBindingContainer.class).getValue(facesContext.getELContext());    
        DCIteratorBinding itr = bindingContainer.findIteratorBinding("Dept1Iterator");   
        DemoAppAMImpl svc = (DemoAppAMImpl)itr.getDataControl().getApplicationModule();
        PreparedStatement stmt = svc.getDBTransaction().createPreparedStatement("delete from dept_table",DBTransaction.DEFAULT);
        stmt.execute();
            svc.getDBTransaction().commit();
        }catch(Exception e){}

This method in this case is written in a managed bean which is bound to a button on the ui. So, first thing that is done is getting the handle to ApplicationModule using iteratorBindings created for this purpose in the pageDef file. 

Then getting the transaction and firing a sql using the transaction and finally commiting it.
  

Thursday, March 5, 2009

Changing Default View in Jdeveloper

Read a great tip at http://one-size-doesnt-fit-all.blogspot.com/2009/03/jdev-ide-defaulting-to-source-code.html 

It can really save you from lot of frustration in case of jspx or jsff pages which opens in design mode by default which takes comparatively much more time then opening in source view mode.

Wednesday, February 25, 2009

Improving Performance in Jdeveloper 11g

From a user experience .... 

# Make sure you're on the latest version of 11G (5188). They make performance improvements with every release. 
# configure jdeveloper to open jsp/jsff's in source view. 
# Use the property editor if possible. Avoid typing in the source 
# Disable the source control plugin - Use Tortoise SVN or other source control outside of jdeveloper. 
# Recommend a minimum of 3G but 4G preferred 
# set the ide.conf memory size to at least 768 
# Restart jdeveloper if memory usage climbs above 1G 

Do you any tips? or more explanations to this?

Monday, February 16, 2009

Managing Tasks /TODOs in Jdeveloper 11g

Well, while writing a big code may be part of a a big app or module how do you track the left over or low priority things to fix?  There are two classifications of fix for later things. 1. Things which are a either a part of minor enhancement or are low priority keeping approaching deadlines. 2. You are working for a duration where it is likely to start forgetting what all you have to finish before final delivery.

for the 1st case using jdeveloper tas
ks feature is not really a too good thing unless. But for the 2nd case where you are whole and sole of some piece of code and have to track all todos for a shorter duration then there is a brilliant feature in jdev called tasks.

To enable it you need not to do anything. Simply write at  //TODO  anywhere in the code editor.  And, jdeveloper will automatically mark it as a todo item. 

To see or manage all your TODO's you can go to menus-->View -->Tasks and a small pane will appear in the bottom showing all the TODOs.

You can update existings ones, delete, change priority and add new as well. Double click on any todo willl take you to the marked position.


You can list the task for the current project or app or file only. There is useful filtering option available which can be used to set custom filter like show all which has a due date tomorrow (u need to put actual date). etc.





Wednesday, February 11, 2009

Page load performance of query page in ADF

Well, a considerable number of the pages in an application is likely to have query components.  By default in ADF when the page renders it executes all the iterators  and executables (in other words data control bindings which would be bound to VOs or other AM or managed bean methods). 

So, that means associated queires to VOs will be executed and depending upon the size of underlying table, connectvity with the db, indexing of table etc it may take a considerable time for the page to come up for the first time. 

Even it is the intension of the end user to open a qeury page for querying the data but still running the app and waiting for the page to come up for more than 15-20 sec may be quite annoying. So, a better idea from user experience perspective is to show the page as soon as possible and then let user query it himself by hitting a search button.

If this makes sense to you then the solution for the same is to create a view criteria and unchek the query automatically check box. This will prevent the initial SQL execution.

A more details explaination is provided by Andrejus at his blog with a sample app.

Friday, January 25, 2008

Procedure and Function in a Package

You can use following query to find procedures and function names defined in a Package:

select distinct object_name from all_arguments where package_name = 'package_name';

To find the entire source you can use:
select text from user_source WHERE type = 'PACKAGE' and name='package_name';

Oracle SQL Finding Primary Key on a table

To find the primary key defined on a database table in oracle you can use:

SELECT cols.table_name, cols.column_name, cols.position, cons.status, cons.owner
FROM all_constraints cons, all_cons_columns cols
WHERE cols.table_name = 'TABLE_NAME'
AND cons.constraint_type = 'P'
AND cons.constraint_name = cols.constraint_name
AND cons.owner = cols.owner
ORDER BY cols.table_name, cols.position;