Thursday, 29 May 2008

ODTUG = AU$51

I'm privileged this year to be invited to the ODTUG conference by Oracle under the Oracle ACE Director program. I look forward to seeing everybody from OOW07 as well as meeting a whole swag of new people.

So why does ODTUG = $51 Australian dollars? This is the cost for me to offset the CO2 generated from my return flight from Perth Australia to New Orleans. Coincidentally 51 is also the number of hours it will take me to get there and back. It's a trip just on 17500kms, or 10900 miles! It's just lucky I like learning things about Oracle really.

I hope to see you my readers there too. Feel free to come up and complain about all my spelling mistakes, lousy grammar and overly keen interest in all things JDeveloper.

BEA WebLogic vs OAS/OC4J: application redeployment

I had an interesting chat with Steve Button on the OTN OC4J Forum today that I thought others might be interested in, namely how to deal with the JEE redeployment issue of not bouncing the server and users on a new version of an application. An extract from the post:

"I'm currently researching solutions to JEE application redeployment, or more specifically when you want to update an existing deployed application on a JEE app server, how can you do so with minimal interruption to the users?

From my research on the internet I've found two approaches, one with the Oracle OAS camp, and another in the BEA Weblogic camp."

....for the rest of my post and Steve's reply, head here.

Wednesday, 28 May 2008

JDev 11gTP4 customising the DCErrorHandlerImpl class

As per section 27.8 of the JDev ADF Guide 11g for TP4, you're allowed to customise the DCErrorHandlerImpl. This is done by creating your own customised handler class extending DCErrorHandlerImpl, than adding a reference in the ViewController's DataBindings.cpx file.

An example class:

package view.controller.frameworkExtension;

import oracle.adf.model.binding.DCBindingContainer;
import oracle.adf.model.binding.DCErrorHandlerImpl;

class ErrorHandlerImpl extends DCErrorHandlerImpl {
  public ErrorHandlerImpl() { super(true); }

  @Override
  public void reportException(DCBindingContainer dCBindingContainer, Exception exception) {
    super.reportException(dCBindingContainer, exception);
  }
}

On opening the DataBindings.cpx file, selecting the DataBindings node in the structure window, then the ErrorHandlerClass property in the property inspector, and entering your custom package.class name (ie. view.controller.frameworkExtension.ErrorHandlerImpl), you may receive the following error in a dialog:

view.controller.frameworkExtension.ErrorHandlerImpl not an instance of oracle.adf.model.binding.DCErrorHandlerImpl

Or alternatively you may bypass the property inspector and enter the property in the DataBindings.cpx file, and at runtime receive the following Java error:

JBO-29000: Unexpected exception caught: java.lang.IllegalAccessException, msg=Class oracle.jbo.common.JBOClass can not access a member of class view.controller.frameworkExtension.ErrorHandlerImpl with modifiers "public"

The basic error here is being raised because your custom error handler class is not "public". Simply change the class to be publically accessible, such as:

public class ErrorHandlerImpl extends DCErrorHandlerImpl {

If you're interested on finding more help on JDeveloper errors, visit the wiki.oracle.com Understanding ADF Error Codes page.

Tuesday, 27 May 2008

JBO-25030: Failed to find or invalidate owning entity

Steve Muench has blogged about this error before. In this example we'll talk about 2 settings in an ADF BC composition association that will cause the same error, and an alternative explanation of why the error occurs which some might find useful.

Consider an ADF BC project with a master-detail relationship between two EOs Events and Bookings. The relationship is modelled by an EO Association. The EO Association has either the Composition Association – Lock Top-Level Container property set, or the Composition Association – Update Top-Level History Columns property set (or both). For your reference these are set within the EO Association editor under the Association Properties page.


In addition consider two VOs to represent the EOs, namely EventsView and BookingsView. Within the parent Application Module these are exposed as follows:


Note how the BookingView is both exposed as a detail to the EventsView1 called BookingsView2, and as a parent in its own right called BookingsView1.

Now if you open the Business Components Browser, and create a record in BookingsView2 which is the detail of EventsView1, you'll have no issue. However if you create a record in BookingsView1 which is not a detail VO, you'll receive the error message:

(oracle.jbo.InvalidOwnerException) JBO-25030: Failed to find or invalidate owning entity: detail entity <entity name>, row key null.


The reason you receive this error is because of the Association properties you set above. Specifically you've defined BookingsView as a child within a Composition Association. A Composition Association is an EO Association which says the child VO rows cannot exist outside the context of the parent, in this case the EventsView1 parent row. And in addition by either setting the Lock Top-Level Container or Update Top-Level History Columns options, you're forcing ADF to go search for the parent VO for the current child VO to either Lock the Top-Level VO, or Update the Top-Level VO's history columns.

So when you create records in BookingsView1 you get an error because it has no parent VO, but if you create records in BookingsView2 which is a child to EventsView, you don't get the error because the parent EventsView VO exists.

Note this issue has been replicated in JDev 10.1.3 and JDev 11g TP4.

If you're interested on finding more help on JDeveloper errors, visit the wiki.oracle.com Understanding ADF Error Codes page.

Sunday, 25 May 2008

3rd most popular OOW08 session!

On returning from running a training course in Adelaide South Australia I had a chance to go back to mix.oracle.com yesterday and check out how my proposed OOW08 sessions are going. I received a pleasent surprise finding that my session Back to basics: Simple database web services without an application server is at equal 3rd spot!

I'm pretty happy with this outcome; I thought a pragmatic database programmers presentation would be a good idea, and it's the sort of thing I prefer presenting on. Hopefully it will cut the mustard and Oracle will include it the OOW08 schedule. If it doesn't at least I know it's a popular topic given the votes and I can use this to propose the session at other conferences including user group events.

I also note local Aussie Richard Foote is currently in 5th place with Indexing Secrets With Richard Foote. That's a good turn out for the Australians.

If you haven't had a chance to vote on the OOW08 sessions listed at mix.oracle.com (registration required), head over to the site and help us create a conference driven by what the delegates want to hear and see!

Thursday, 15 May 2008

Fun with Oracle 11g virtual columns - revisited

I've been having some fun with Oracle 11g's virtual columns feature. For those who are uninitiated, there's already a qwzillion blog posts about this feature, including this good one from Tim Hall among others.

Following are a couple points I've noted about virtual columns that haven't been caught in the Oracle documentation nor any of the regular blogs I read, which may be of interest to others. Take the following example:

SQL> CREATE TABLE virtual_column_test (
  2    columna NUMBER
  3   ,columnb AS (columna + 1)
  4   ,columnc AS (columna + 2));

Table created.


1) You can use the DEFAULT keyword in an INSERT clause to avoid having to populate the virtual columns:

SQL> INSERT INTO virtual_column_test
  2  VALUES (1, DEFAULT, DEFAULT);

1 row created.


2) You are allowed to create constraints on the virtual column such as:

SQL> ALTER TABLE virtual_column_test
  2    ADD CONSTRAINT vct_chk
  3    CHECK (columnc > 3);

Table altered.


SQL> INSERT INTO virtual_column_test
  2  VALUES (1, DEFAULT, DEFAULT);
INSERT INTO virtual_column_test VALUES (1, DEFAULT, DEFAULT)
*
ERROR at line 1:
ORA-02290: check constraint (SAGE.VCT_CHK) violated

SQL> INSERT INTO virtual_column_test
  2  VALUES (2, DEFAULT, DEFAULT);

1 row created.


3) And yes, bizarrely you can create a foreign key constraint:

SQL> CREATE TABLE primary_table (
  2    id NUMBER PRIMARY KEY);

Table created.

SQL> CREATE TABLE child_table (
  2    id NUMBER PRIMARY KEY
  3   ,primary_table_id AS (id + 1)
  4      CONSTRAINT child_table_fk
  5      REFERENCES primary_table (id));

Table created.

SQL> INSERT INTO primary_table VALUES (1);

1 row created.

SQL> INSERT INTO child_table
  2  VALUES (1, DEFAULT);
INSERT INTO child_table
*
ERROR at line 1:
ORA-02291: integrity constraint (SAGE.CHILD_TABLE_FK) violated - parent key not found

SQL> INSERT INTO primary_table VALUES (2);

1 row created.

SQL> INSERT INTO child_table
  2  VALUES (1, DEFAULT);

1 row created.


In addition the Oracle errors code highlight some further limitations.

4) You may not drop a column if it is referenced in a virtual column:

SQL> ALTER TABLE virtual_column_test DROP COLUMN columna;
ALTER TABLE virtual_column_test DROP COLUMN columna
*
ERROR at line 1:
ORA-54031: column to be dropped is used in a virtual column expression


5) You may not rename a column that is used by a virtual column:

SQL> ALTER TABLE virtual_column_test
  2  RENAME COLUMN columna TO columnd;
ALTER TABLE virtual_column_test RENAME COLUMN columna TO columnd
*
ERROR at line 1:
ORA-54032: column to be renamed is used in a virtual column expression


6) There are also restrictions around changing the datatype of a column a virtual column is based on, though this is similar to the restriction on altering a normal table's column's datatype when the table already contains data.

All in all virtual columns look like a useful little addition to the database that we may all start making use of. It would be interesting to read some stats on the performance hit, particular when it applies, as well as how the database optimises if a virtual column is present.

Advert - So you want to be an "Advanced Oracle Developer"? (Perth - Australia)

For my local readers, SAGE Computing Services will be holding a 3 day Advanced Oracle Developer training workshop in Perth Australia July 1st-3rd.

In this course we will not only be looking at the latest SQL and PL/SQL techniques, but more importantly Oracle tuning skills that every Oracle developer and DBA should have in their programmer toolbelt.

This course will be ideal for any developers who are comfortable with SQL and PL/SQL but want to know more on how to make your applications "fly". This course would also be ideal for DBAs whose skills are getting rusty and worried that maybe the developers will know more then them!

More information about the 3 day course can be found here.

Please note we also send out a semi-regular newsletter advertising these types of training courses. If you'd like to join the newsletter mailing list, please email myself at chrisFULLSTOPmuirATsagecomputingFULLSTOPcomFULLSTOPau.

Tuesday, 13 May 2008

4 things I read more recently (Java vs .Net vs the world blah blah blah)

It's an old story that's going to continue in the IT industry for at least the next qwzillion years, the "my technology is better than yours blah blah blah" saga. Of course it makes for interesting reading. The following are posts generally related to Java and .Net:
  • In Defence of Java - Michael Kolling writes why he thinks Java was designed with a number of needed language compromises at the time, followed by the usual open flood gates on "Java-sucks-no-it-doesn't" blog comments.
  • J2EE Vs .NET : Are major development shops moving to .NET? - Meera Subbarao picks up the discussion about Java vs .Net, but attempts to skip the technology issue and instead look at industry trends, whether there is a full stampede towards .Net away from the Java arena. The conclusion: management could do with a slap.
  • Developer Spotlight: Hitting the Seam with Gavin King - Not so much an interview with Gavin King about Seam, but about his view on a whole lot of things happening in the Java arena and the challenges facing it.
  • The coming of .Net – Peter Bright has a rant how Microsoft's .Net had potential but missed the boat in tidying up Microsoft's operating system mess as well as providing a generally poor and inconsistent API set. Follow the whole multi-part series for some interesting reading on Apple.

Thursday, 8 May 2008

ADF Faces RC - the humble inputText control - it's all about the presentation baby!

On conception the JSF specification received lots of complaints for its simplistic component implementations. The original JSF controls such as <h:inputText> were no better than the vanilla HTML equivalents. Sun however didn't intend the core web component set to be used in JSF development, but rather as a showcase to vendors on how to create JSF components so they could write their own enhanced components.

Some years ago Oracle took this all on board when they developed their own JSF component set known as ADF Faces within JDeveloper 10.1.3, and created some pretty "whiz-bang" components. Yet in the contemporary world of web development the recent rage has been about AJAX-AJAX-AJAX, and more recently Rich Internet Applications (RIAs). When it comes down to it in-my-honest-opinion, both AJAX and RIA are about "s3x appeal", ah, I mean how "visually appealing" the web components are, or more specifically how "rich" they are

So Oracle (in their wisdom ;) took this all on board (again) and did some "sprucing" of their own JSF components. We now have ADF Faces Rich Components (commonly known as ADF Faces RC or I'll refer to as RC for short in this post).

So what's changed?

There are lots of new and exciting components, such as accordion controls, sliders, trees, graphs, pivot tables and more (no really, lots more). But what about the good ol' humble <af:inputText> control, has it changed? The answer is yes, but not in the way it functions which is mostly the same, but instead in the way it appears; it's presentation is much better. As the blog title says, it's all about the presentation baby!

Let's check out some of the presentation changes between ADF Faces and ADF Faces RC:

For required fields in both versions we would code the following tag:

<af:inputText value="#{myBean.someValue}" required="true"/>

In ADF Faces and ADF Faces RC they look similar with the label star implying the field is required. The ADF Faces component looked as follows:


And the RC component, which besides a font colour change really isn't that different (yawn):


However in RC if we clear down the field and move to another field, we get this extra red box on the original field highlighting that the field is required:


If we submit the form in ADF Faces while the required field is null we receive this pretty bland browser error box:


Yet in RC we get these sexy graphics:



What happens if in a date field we enter a date with the wrong format mask supplied through validation + converter sub-tags? ADF Faces:


Yuck, another horrible browser dialog box. And in RC:


What about in an inputText control with converters and validators based on a number datatype? In ADF Faces if we enter character data into the number field we get:


No change. Yet in RC we see the sexy format mask tooltip plus the error border:


How about errors raised from the Model layer. ADF Faces:


And errors in RC:


As you can see there are plenty of changes to this humble little component. I'd argue the changes are all subtle in functionality because essentially the component still does exactly the same thing. However the changes are not so subtle in their presentation.

You might ask why did I bother to focus on such a trivial thing? Sometimes in the avalanche of new features in a new release I feel a little overwhelmed. So I like to go back to the basics and see how they've subtly changed in the new release, because these are the features we're more likely to make use of regardless of the new whiz-bang in the later releases.

This article was written using JDev 10.1.3.3 and JDev 11g TP4. Your mileage may vary on later releases.

Tuesday, 6 May 2008

OOW08 sessions on the Mix

Recently Justin Kestelyn blogged that Oracle is giving us the opportunity on the Mix to submit and vote on proposed presentations for Oracle OpenWorld 2008. Neat! Now we can all vote on Larry doing the Chicken Dance during the keynote!

I've taken the opportunity to post 4 sessions around the theme "back to basics" to assist those new to JDeveloper and Web Services. I hope you'll take time out to vote for them on the Mix as well as other presentation ideas you like:

Monday, 5 May 2008

JDeveloper: team development and version control tug-of-merge-war

For those who have used JDeveloper in a team based environment developing with ADF BC & Faces, you'd be familiar that there are a few essential files that become problematic in the supported version control systems. As an example under JDev 10.1.3 the ADF BC project's .jpr file is continuously touched while developers are modifying ADF BC objects, resulting in a file version control tug-of-merge-war on the .jpr file as it is copied back and forth from the file version repository on each developer's machine.

Thanks to Timo and Brenden (and the Geelong crew) recently on the OTN JDev forums, there was an interesting chat on their experiences on other files that cause similar issues. I refer you to the post to assist your understanding in the issues, as well as to add your own experience and solutions.

Friday, 2 May 2008

Why neither Apex or JDeveloper are actually "free"

I've always had trouble with the word "free". Because the people who bandy it around are typically in marketing and sales (or consulting ;). And they wouldn't be in a job if they actually sold stuff for "free".

Recently PsyBlog had a well articulated blog entry describing this sales-speak: FREE! But at What Price?

This is why the marketing for Apex and JDeveloper as "free" doesn't sit well with me, and neither the zeal behind the Apex and JDev camps with the argument "but it's free!". To me free means 100% free. No conditions attached. Forever. Covers all cases for you and me and everyone else. There shouldn't be a "yeah-but" situation with free.

As such Apex strictly isn't free because the majority of users are running it on a purchased licensed Oracle database edition. Of course it's "free" if you use it on Oracle XE, but I've yet to find a single customer with a substantial Oracle install willing to downgrade to the Oracle-lite version. I'm not saying there aren't Oracle XE sites out there, but (from my subjective experience) in the scheme of things most Oracle customers aren't using Oracle XE for production purposes. The Oracle salesman already got'em.

In turn JDeveloper isn't strictly "free" either. Arguably the IDE is, but JDeveloper is coupled with ADF (not free), WebCenter (not free) and SOA (not free). If we specifically look at ADF it is "free" as long as you own an OAS license or pay a per user seat license.

A question arises though, why did Oracle bother to make these tools "free", or more specifically the marketing exercise of "free"?:

Arguably for JDeveloper it was the other competing Java IDEs, namely Eclipse and NetBeans are free, so Oracle needed to compete on the same playing field to entice those sarcastic and critical Java crowd. For Apex the reason is not so clear to me as I don't work in the Apex circles and maybe a reader can put their opinion forward. If Apex only runs on Oracle, why bother with the "free" marketing unless it's just a feel-good? Why not just say SQL and PL/SQL are also free with the database? Why did they pick Apex? To compete with JDev? I dunno.

So the next question arises, how could Oracle go about making these tools really "free" (be it a realistic dream or not)?:

For JDeveloper it's obvious. If you couple a component such as ADF with the IDE, then remove any of the OAS license caveats. Otherwise if you're going to include another part in the base download, either make it free or strip it out as a clear downloadable plug-in.

For Apex, if I use an Oracle non-XE edition (eg. SE, EE etc), and I use no features but those available to Oracle XE, and Apex, then make it free across the board, database included, regardless of edition.

Realistic: no?

Idle Friday musings?: yes.

Give you a good chuckle?: I hope so.

Oh, and I'm still waiting on Oracle to apply the same "free" marketing to Oracle Forms, be it "free" as long as you install to OAS ;)

BTW, take time to check out other articles on PsyBlog. My recent favourite: How Children Learn the Earth Isn't Flat.

4 things I read more recently (which language will make me filthy rich!)

People spend a lot of time arguing their language is best. A pointless exercise. They really should focus on which language is going to make them dirty rotten filthy rich!:
  • Java Jobs in Decline? Not So Fast! - James Sugrue on JavaLobby throws the idea in the air that Java isn't on a decline, it's the whole IT industry. Doom doom doom I say! Make sure to check out the comments
Okay, so that's 5 entries. Oops.