Oracle Blog

Chris Muir's blog

Monday Feb 04, 2013

It's a tad early to advertise this, but as I'm receiving a few enquiries are we looking to run any ADF Mobile workshops in Australia anytime soon, I'd like announce yes indeed, we've a series of workshops planned with the Australian Oracle User Group (AUSOUG) in late April/May.

This 1 day ADF Mobile workshop will give you the opportunity to learn how to create on-device mobile applications that run on both iOS and Android. This workshop will explain the unique challenges and common use cases of mobile applications and then dive into possible mobile architectures. The workshop will walk you through developing mobile applications that install and run on the device and are able to leverage device-specific features - all with the new Oracle ADF Mobile solution. No previous knowledge of Oracle ADF is needed!

The schedule is follows for the following Aussie cities. Follow the links to register separately for each city:

Are you interested in developing for the mobile platform but not sure where to start?

The ADF product management team is happy to announce we've joined with the NZOUG conference on the 18th/19th March to add an a bonus ADF Mobile workshop on Wednesday 20th in Wellington where you can learn how to create on-device mobile applications that run on both iOS and Android.

This workshop will explain the unique challenges and common use cases of mobile applications and then dive into possible mobile architectures. The workshop will walk you through developing mobile applications that install and run on the device and are able to leverage device-specific features - all with the new Oracle ADF Mobile solution. No previous knowledge of Oracle ADF is needed!

If you're interested in attending the workshop, you can register for the workshop here, and alternatively if you'd also like to attend the NZOUG conference, you can register here.

Wednesday Jan 16, 2013

In 2012 the Oracle ADF enablement product management team announced a new OTN website the ADF Architecture Square which includes the ADF Code Guidelines paper. This paper before it was originally published not only considered ADF best practices, but also suggestions for ADF naming conventions and guidelines for project layouts. However it was quickly realized the document was going to become too large and unwieldy, so we split it.

Today the ADF PM team is happy to announce the publication of the resulting second document the ADF Naming and Project Layout Guidelines. Just like its sister publication, besides giving you guidelines on ADF naming conventions and project layouts, the document has been produced to allow new ADF development teams a shortcut in writing their own such document. If you've already got your own, good for you, dont change.

Having been embroiled in bipolar arguments with developers in the past about their preference for naming standards (I might have been one of the developers ;-), of the two documents I do expect this document to be more contentious than the sister publication. And indeed there was a few debates inside Oracle in producing this document about the use (or not!) of Hungarian notation in ADF. Yet the thing to realize is in many cases naming conventions are a personal preference. And as the document clearly tries to state, if you don't like the guidelines, one size doesn't fit all, change them!

Like the previous document this paper has been designed to be a living document that will change and evolve over time. We encourage customers to discuss these guidelines on the ADF EMG, and log any issues on the ADF EMG Issue Tracker so we can continue to improve them.

Friday Jan 11, 2013

An uncommon but valid customer use case for ADF BC is to have two root AMs that point at entirely two different connections/data sources/JNDIs within the same Model project. For example maybe you need to connect to both an Oracle and SQL-Server database to show data from two different database systems. Or maybe you even need to connect to the same Oracle database but two different schemas.

Now one solution to this problem is to solve it at the database level. This really is the preferred route as the database has some awesome tools for solving these sorts of issues such as database links, gateways and more. Remember that the database and these tools have all sorts of supports for tricky database issues such as distribution, 2 phase commits, all the sort of tricky issues that years of effort have gone into solving which to be basic, a normal Java programming team wont be able replicate.

However sometimes we're simply not going to be able to use those tools or we just want a simple ADF solution for getting data from two databases.

So how do we do this in ADF?

The solution is fairly simple, we need:

a) 2 separate database connections

b) 2 separate root AMs and associated VOs/EOs

c) Any page/fragment we drop the VOs/EOs, for the relating task flow we *must* use the <No Controller Transaction> option

In considering each of these parts to our solution:

a) It's not immediately obvious but we are free to use more than one database connection in our application as the following picture demonstrates:

When you have more than 1 database connection you must be mindful that via the Model project properties, the ADF Business Components options has a Connection poplist that defines the default database connection for the project to use at design time as can be seen here:

It's up to you when you run the various ADF BC wizards to ensure you have the right database connection selected.

b) Once you've defined your two connections, you're now in a position to use the associated ADF BC wizards to create your various ADF BC components. You will need to return and manage the default database connection at the Model -> ADF Business Components -> Connection project property to ensure you are connecting to the right database each time you run the wizards. JDev wont give you any help here, so be careful!

In the following picture it shows the end results of creating a Model project, with a Regions EO/VO exposed via the HrAppModule connecting to the HR Oracle database schema, and another EO/VO Customers exposed via the OeAppModule connecting to the OE Oracle database schema:

Note there's an IDE bug 16032880 we need to be wary of here and double check the IDE hasn't introduced an error with the associated JNDI data sources for the AMs. Each change to the Connection option at the Model ADF BC project properties level, it will override all the data sources of the root AMs with the one you just picked. If you locate the bc4j.xcfg file that holds the JNDIs, check that the data sources for the associated AM configurations are correct. For example for the two AMs, I expect to see the following <Custom JDBCDataSource> entries for each configuration:

If you do discover an error simply repair this in the file, save all, and the issue will go away. Ensure to test in the Business Component Browser to make sure the AMs are configured correctly and you can see data from both VOs.

c) Having sorted out the Model layer you can now move to the ViewController layer. Typically you'll start creating pages and fragments in your unbounded task flow (UTF) and bounded task flows (BTF) making use of the VOs you've just exposed through the separate AMs.

In doing so you must be aware that the transaction options you pick for your BTFs can change the connection behaviour of your AMs you have just setup. Here are the bounded task flows supported 4 transaction options:

Strictly speaking it's 3 options that are related, that being Always Begin New Transaction, Always Use Existing Transaction and Use Existing Transaction if Possible, plus the ability to turn this feature off known as <No Controller Transaction>. You can read more about these options here (see the Task Flow Transaction Fundamentals paper).

There's a back end feature built into the task flow transaction management where if your application makes use of multiple ADF BC data controls mapping to separate root AMs, at runtime ADF BC will try to share connections amongst the root AMs at runtime. While this may seem disastrous to what we're attempting to achieve here, this feature is very important for creating scalable applications where our architecture has forced us to create separate root AMs, typically we don't want one user to take out several database connections.

Luckily task flows still provide a solution for our use case that is counter to this described functionality. Rather than picking one of the BTF transaction options, that being Always Begin New Transaction, Always Use Existing Transaction and Use Existing Transaction if Possible, instead pick the <No Controller Transaction> option. The <No Controller Transaction> option doesn't override the connections of the root AMs and allows them to connect to any JNDI they define at runtime.

And that's all there really is to the solution. You just need to make sure you have the right configurations for your root AMs, the Model project ADF BC connection, and the task flow transaction options.

Questionably what about the unbounded task flow? It doesn't allow us to define any transaction options, what do we do if we use our VOs in pages/fragments of the UTF? For all intent and purposes you can treat the UTF as using the <No Controller Transaction> option.

What about the task flow Share Data Controls with Calling Task Flow option? What do we set that to? The previous Task Flow Transaction Fundamentals paper details that in full, but to say, if you untick that option (known as an isolated data control scope) for the current BTF, a brand new instance of the current root AM and relating VOs/EOs will be instantiated for the current user for the life of the BTF. If you select the check box (known as a shared data control scope), if an instance of the ADF BC AM is already being used in a previous BTF that called this BTF, simple the ADF BC AM data control will be shared. If it doesn't yet exist it will be created for the first time.

Sample App

I've provided a sample application for you to see this behaviour based on the scenario described above. It requires access to both the HR and OE sample Oracle database schemas.

When you run the app via the Splash.jsf page and navigate to the CombinedTaskFlow, back in JDev open the database navigator and locate both tables in the separate schemas, and the associated records that are currently showing in the app. Now in the app you can change and commit each VO and watch the changes independently saved to the corresponding records in the separate schemas in the database. Note you can change and commit the records independently, committing one will not commit the other.

Troubleshooting

It's worth while having a look at how things break too. If you open the CombinedTaskFlow.xml in JDeveloper and change the BTF transaction options to Always Begin New Transaction, rerun the app, you'll notice on arriving at the CombinedTaskFlow you'll receive a database error "ORA-00942: table or view does not exist". As described previously the other BTF transaction options combine/share the connection of the first root AM at runtime, in this case the HrConn. As such as soon as the CustomersView attempts to query from the CUSTOMERS table in the database, as its root AM is now sharing the connection of the HR root AM it can't see the required tables.

Alternatively if you fix this change and return to the ADF Business Components Connection option under the Model project properties, and switch the connection to OeConn, this will modify all the JNDI connections in the relating bc4j.xcfg file to point at the OE schema. On rerunning your app you'll again see "ORA-00942: table or view does not exist". Again in this case be cognizant of bug 16032880 described earlier and how to fix the problem.

Wednesday Jan 02, 2013

Are you an ADF developer who uses Google+? The Oracle ADF product management team has recently extended our Google+ page with a Google+ JDeveloper and ADF Community. If you're keen head on over and subscribe to receive updates and news about JDeveloper and ADF, as well participate in discussions in the ADF community. In particular if you want to become an ADF community leader, it's a great opportunity to make a name for yourself in this virgin Google+ community.

Along with Google+ this gives you a fair amount of choice on the social media services you can participate in. For reference here's a few more:

Thursday Dec 20, 2012

ADF Business Components support the ability to publish the underlying Application Modules (AMs) and View Objects (VOs) as web services through Service Data Objects (SDOs). This blog post looks at a minor challenge to overcome when using SDOs and Entity Objects (EOs) that use a composition association.

Using the default ADF BC EO association behaviour

ADF BC components allow you to work with VOs that are based on EOs that are a part of a parent-child composition association. A composition association enforces that you cannot create records for the child outside the context of the parent. As example when creating invoice-lines you want to enforce the individual lines have a relating parent invoice record, it just simply doesn't make sense to save invoice-lines without their parent invoice record.

In the following screenshot using the ADF BC Tester it demonstrates the correct way to create a child Employees record as part of a composition association with Departments:

And the following screenshot shows you the wrong way to create an Employee record:

Working with composition associations via the SDO web services

Shay Shmeltzer recently recorded a good video which demonstrates how to expose your ADF Business Components through the SDO interface.

On exposing the VOs you get a choice of operation to publish including create, update, delete and more:

For example through the SDO test interface we can see that the create operation will request the attributes for the VO exposed, in this case EmployeesView1:

In this specific case though, just like the ADF BC Tester, an attempt to create this record will fail with JBO-25030, the composition association is still enforced:

The correct way to to do this is through the create operation on the DepartmentsView1 which also lets you create employees record in context of the parent, thus satisfying the composition association rule:

Yet at issue here is the create operation will always create both the parent Departments and Employees records. What do we do if we've already previously created the parent Departments records, and we just want to create additional Employees records for that Department? The create method of the EmployeeView1 as we saw previously doesn't allow us to do that, the JBO-3050 error will be raised.

The solution is the "merge" operation on the parent Departments record:

In this case for the Departments record you just need to supply the DepartmentId of the Department you want the Employees record to be associated with, as well as the new Employees record. When invoked only the Employees record is created, and the supply of the DepartmentId of the Departments record satisfies the composition association without actually creating or updating the associated Department record that already exists in the database.

Be warned however if you supply any more attributes for the Department record, it will result in a merge (update) of the associated Departments record too.

Friday Oct 26, 2012

I'm happy to report that the number of ADF published books is expanding yet again, with this time Oracle's own Jobinesh Purushothaman publishing the Oracle ADF Real World Developer’s Guide. I can remember the dim dark days when there was but just 1 Oracle book besides the documentation, so today it's great to have what I think might be the 7 or 8th ADF book publicly available, and not to forgot all our other technical docs too.

Jobinesh has even published some extra chapters online that will give you a good taste of what to expect.

If you're interested in positive reviews, the ADF EMG already has it's first happy customer.

As part of my regular job I've read *every* book on ADF. Given there's now several ADF beginners' books I thought the introductory level to ADF area was already amply covered, and I didn't know what Jobinesh's latest ADF text could add. However I must admit I was pleasantly surprised, as even though this book obviously covers many beginners topics, it also covers topics the others haven't making it another valuable addition to the ADF textbooks currently available.

Of particular interest to me was the introduction of:

1) Framework class diagrams - explaining for example how the ADF BC and binding layer classes relate to each other, therefore giving insight into what objects you actually work with programmatically when you drop to code in ADF

2) JSF Servlet, ADF Servlet & Filter lifecycle - a soup-to-nuts discussion starting at the configuration of the web.xml, the importance of the order of the filters, and the overall lifecycle of the framework

3) Application Module scenario diagrams - what objects and methods get called when an Application Module is instantiated so not only do you get an abstract discussion of the AM lifecycle, but how it relates to actual code.

Don't get me wrong, Jobinesh covers all the usual beginner topics, ADF Business Components, task flows, ADF Faces and more, but the fact that he's focused on the Java and Java EE side of ADF brings two very useful discussions on the framework together, which I believe creates a good learning opportunity.

Wednesday Oct 17, 2012

During Oracle Open World 2012 the ADF Product Management team announced a new OTN website, the ADF Architecture Square. While OOW represents a great opportunity to let customers know about new and exciting developments, the problem with making announcements during OOW however is customers are bombarded with so many messages that it's easy to miss something important.

So in this blog post I'd like to highlight as part of the ADF Architecture Square website, one of the initial core offerings is a new document entitled ADF Code Guidelines.

Now the title of this document should hopefully make it obvious what the document contains, but what's the purpose of the document, why did Oracle create it?

Personally having worked as an ADF consultant before joining Oracle, one thing I noted amongst ADF customers who had successfully deployed production systems, that they all approached software development in a professional and engineered way, and all of these customers had their own guideline documents on ADF best practices, conventions and recommendations. These documents designed to be consumed by their own staff to ensure ADF applications were "built right", typically sourced their guidelines from their team's own expert learnings, and the huge amount of ADF technical collateral that is publicly available. Maybe from manuals and whitepapers, presentations and blog posts, some written by Oracle and some written by independent sources.

Now this is all good and well for the teams that have gone through this effort, gathering all the information and putting it into structured documents, kudos to them. But for new customers who want to break into the ADF space, who have project pressures to deliver ADF solutions without necessarily working on assembling best practices, creating such a document is understandably (regrettably?) a low priority.

So in recognising this hurdle, at Oracle we've devised the ADF Code Guidelines. This document sets out ADF code guidelines, practices and conventions for applications built using ADF Business Components and ADF Faces Rich Client (release 11g and greater). The guidelines are summarized from a number of Oracle documents and other 3rd party collateral, with the goal of giving developers and development teams a short circuit on producing their own best practices collateral.

The document is not a final production, but a living document that will be extended to cover new information as discovered or as the ADF framework changes.

Readers are encouraged to discuss the guidelines on the ADF EMG and provide constructive feedback to me (Chris Muir) via the ADF EMG Issue Tracker.

We hope you'll find the ADF Code Guidelines useful and look forward to providing updates in the near future.

The unique highlight this year for me was the first ever ADF EMG social night held on Saturday, where I finally had the chance to meet so many ADF community members who I've known over the internet, but never met in person. What? You didn't get an invite? Oh well, better luck next year ;-)

Seriously our budget was limited, so in the happy-dictatorship sort of way I had to limit RSVPs to just 40 people. Hopefully next year we can do something bigger and better for the wider community.

Following directly on from the Saturday social night the ADF EMG ran a full day of sessions at the user group Sunday. I wont go over the content again, but to say thank you very much to all our presenters and helpers, including Gert Poel, Pitier Gillis, Aino Andriessen, Simon Haslam, Ken Mizuta, Lucas Jellema and the FMW roadshow team, Ronald van Luttikhuizen, Guido Schmutz, Luc Bors, Aino Andriessen and Lonneke Dikmans.

Also special thanks must go to Doug Cockroft and Bambi Price for their time and effort in organizing the ADF EMG room behind the scenes via the APOUC. To be blunt Doug and Bambi really do deserve serious thanks because they had to wear a lot of Oracle politics behind the scenes to get the rooms organized (oh, and deal with me fretting too! ;-).

Finally thanks to all the members and OOW delegates for turning up and supporting the group on the day. In the end the ADF EMG exists for you, and I hope you found it worthwhile.

Over the last number of years Oracle has recognized that many customers have matured their ADF skills and are now looking for information on advanced concepts beyond the how-do-I-get-this-poplist-to-work type questions. In order to satisfy this demand we've devised the ADF Architecture Square where papers, presentations and demos will consider such broad software engineering concepts as ADF architecture, development and testing, building and deployment, and infrastructure.

If you have a look at the site right now it's a rather modest affair, but we hope to continue to expand the content to give further guidance and information to help shortcut your ADF project needs. Either watch the website or follow our dedicated @adfarchsquare twitter feed.

Thursday Sep 13, 2012

Yesterday saw the next ADF Community Event in Perth, and as promised we grew from 15 to 25 attendees (which is going to cause a bit of a problem soon if we keep growing as we're going to run out of powerpoints for laptops).

This bimonthly enjoyed presentations from Matthew Carrigy from the Dept of Finance WA on the ADF UI Shell, a small presentation from me about how Fusion Apps uses ADF, and a hands on based on programatically extending ADF BC to call external web services. For Matt, his first presentation to a user group, with two live demos, all kudos to him for making it look smooth (for the record I hate live demos, I always break something) - thank you Matt!

We've already lined up our speakers for the next event in November, and will be inviting yet more customers to this event. However the event will now move to an open invite, so if you'd like your staff to attend please let me know by emailing chris DOT muir AT oracle DOT com.

Alternatively I've had a fair few requests now for an "Intro to ADF" 1 day session so I'll consider this soon. Certainly if you're interested let me know as this will help organize the event earlier rather than later.

While Oracle Open World is the place to be for ADF presentations, for Aussies living in Perth, San Francisco is a tad far away (believe me from experience, the 23hrs flight from PER-SYD-SFO is tedious). That's why I'm very excited to see that the Australian Oracle User Group at this year's Perth conference is running its largest set of ADF presentation to date: 5!

Okay, it doesn't compare to the 60 ADF sessions at OOW, but it's a small conference of around 300 people that runs for 2 days with 54 sessions total, not 40000 people that runs for 5 days with 1900+ sessions, so I think that's a good effort for a conference that's at the end of the earth!

What's even better about this year's conference, is the AUSOUG conference is moving away from just consultants and Oracle staff presenting, but will also include customers presenting on ADF too. This again proves Perth is a little ADF hotspot, which puts a tear to an ADF product manager's eye let me tell you ;-)

The ADF sessions will include:

Kevin Payne - JWH Group - ADF Mobile Application Development

Matthew Carrigy - Department of Finance Western Australia - The times, they are a-changin’ - An Oracle Forms to JDeveloper ADF Case Study

ADF developers are hopefully aware of our ADF Insider Essentials recordings, a page full of presentations from small to large topics on all-things-ADF. A couple of customers have pointed out these recordings aren't accessible via the iPad and other Apple OSX devices thanks to the recordings being wrapped in an Adobe Flash applet.

To satisfy this need we've now uploaded all of the videos as MP4s to our ADF Insider Essentials YouTube channel for your iPad viewing pleasure. So now regardless if you're sitting at your PC or on the couch with your iPad, you can enjoy my horrible Aussie accent amongst the more professional ADF presentations from my colleagues ;-)

Make sure to subscribe to the YouTube channel to receive notifications of newly uploaded content.

Thursday Aug 23, 2012

I'm happy to announce that the ADF EMG will be continuing on from its success in 2011, and will be running "The Year After the Year of the ADF Developer" at Oracle Open World 2012.

On the user group Sunday 30th of September the ADF EMG has a full day of sessions for anybody interested in ADF. The collective sessions are designed to have something for everyone, ADF beginners, ADF experts, all. All sessions will be held in Moscone South room 305.

To start out with for OOW attendees coming from a Forms background, Gert Poel and Pieter Gillis from iAdvise will give us the lowdown on ADF for Forms programmers. This is a very important presentation for the beginners in the ADF community who are coming from a Forms background:

At the other end of the spectrum for EMG members who are looking to expand their ADF skills beyond the basics, Aino Andriessen from AMIS will be looking at using Hudson for building ADF applications. Surprisingly via the EMG new member's survey around 25% of new members have no idea about CI tools so I think Aino's presentation is a great addition to the ADF EMG line up:

In this presentation Simon Haslam will be discussing the actual Fusion Apps "ADF" architecture. In other words forgot the high level "yes ADF was used to build Fusion Apps" bullet points, Simon is going for a deep dive into the nitty gritty details of how ADF was used to build Fusion Apps. For ADF EMG members remember all those times you posted to the EMG wishing to know more details about how ADF was used in Fusion Apps? This is the session for you to learn and bring your own questions.

But the fun doesn't stop here. The final presentation is a muti-slot presentation, where a team of FMW programmers, including ADF programmers, SOA programmers and more will build an end-to-end application, live in front of your very eyes:

Why this presentation rocks, is rather than a single presentation on ADF here, then a separate presentation on SOA there, the goal of this presentation is to bring it altogether so you can see an end-to-end Fusion Middleware application being built at once. I've seen this before, this is a great session, and I highly recommend it.

I hope you'll take the opportunity to attend and support the ADF EMG this year, I'm especially keen to see new faces and meet old friends and to continue supporting it's members.

Of course note rooms and times may change, so ensure to check the schedule builder closer to the event.

Friday Aug 17, 2012

Just over a year ago Oracle released the 11gR2 branch of JDeveloper starting at version 11.1.2.0.0. The primary reason for that release was giving customer's JSF2.0 support in ADF, though our 11gR1 branch remains for various reasons.

While JSF2.0 is the primary reason to check out 11gR2, there are some minor other benefits including that of ojserver, which is ojdeploy's big brother.

I first became aware of ojserver when Oracle ACE John Stegeman mentioned it when he spotted in 11.1.2.0.0, it's come up on the ADF EMG a number of times, and I've been curious about it ever since. Part of that curiosity is peaked by the fact that ojdeploy is one of Oracle's, let's say, least loved products. I'm not utterly convinced by the naysayers' arguments about ojdeploy, but putting that aside, it does leave us wondering what ojserver does and what problem it attempts to rectify for ojdeploy.

Why ojserver was invented was to address an issue with the Fusion Applications build. To date the statistics for the size and number of libraries in Fusion Apps is rather impressive. And it is ojdeploy's task to build all those libraries and the resulting application. At one stage it was observed the Fusion Apps build times were becoming rather long, and with a bit of analysis it was determined that the start and stopping of ojdeploy for each build component was a large time sink.

Why was this? ojdeploy is ultimately a "headless" JDeveloper which requires it's own JVM to start, run and stop. As you can appreciate that lifecycle takes time. If you call it seven hundred times, that's seven hundred times ojdeploy needs to be start, run and stop. There's not much we can do about the run bit, that's the bit when ojdeploy is actually doing it's real job, but is there anything Oracle could do to fix the start and stop cycle?

Enter odeploy's big brother ojserver.

ojserver is essentially a server version of ojdeploy, in the sense that once started it stays alive and can be asked to, well serve stuff ;-) As such what you can ask ojdeploy to do is rather than build each library itself, just hand the request off to ojserver instead, which has already been started. Brilliant. We no longer have to start and stop the ojdeploy process for each build item, we just start it once at the beginning, and stop it once at the end.

To start ojserver you simply execute the following from the jdeveloper/jdev/bin directory:

ojserver -start

This will start the service on localhost port 2010 by default. You can override this by specifying the address after the -start flag. On starting the server you will eventually see:

INFO: Server ready.

We're now ready to rock n roll with ojdeploy. The following shows you an example of how to call ojserver from ojdeploy from a separate command line, note the additional -ojserver and -address flags:

In context of ojdeploy you will not see much activity in the logs. Rather all activity include build output, errors and more will come from the ojserver logs.

One thing to keep in mind is if you're accessing ojserver remotely from ojdeploy remotely, for the given paths for the ojdeploy -workspace flag and more, ojserver must have access to those paths and the source code. Remember ojserver is just a server version of ojdeploy, there's no magic copying of files between ojserver and ojdeploy, so in terms of building applications and the files it needs, it's the same as ojdeploy.

Note there is currently one known limitation with using ojserver and ojdeploy via Ant (as separate to the command line call above). At the moment the OJDeployAnt taskDef that you define in Ant to call ojdeploy currently does not support parameters for calling ojserver. ER 14464838 has been raised to address this limitation.

In the above example I've truncated some of the Ant property names using "jdev" rather than "jdeveloper" so the code will fit in the width of the blog. Ensure to double check these with your own Ant property names.