Thursday, October 28, 2010

Generating modeled database layout from JDeveloper

JDeveloper is a fantastic development tool that allows one to model and develop all layers of an application from the data all the way to the user interface and beyond. One of these awesome features is exposed via the database modeler. Here you can lay out everything pertaining to the data structure of your application prior to creating that structure in a database before actually generating it saving you the headache of repeatedly creating new DDL to make tweaks as you get it just right. Once you've done that you can then go on to generate the default data services that will fulfill the object side of the object-relational bridge of your application right from there as well!

In the database modeler you have options for everything you could think of: tables, views (materialized or not), constraints, keys, custom types, procedures, sequences, you name it. What was funny was I had one of those moments the other day when generating a data structure for a test application I have been working on that prompted my posting.

So anyway, I had modeled out my data structure, had my database connection set up and was ready to generate the modeled structure so I could begin working on creating my business components.

So here you can see the context menu used. I select what I want to create (in this case Ctrl-A for everything), and then right-click on the diagram selecting in the context menu: Synchronize with Database->Generate To->[database connection name].

I then jump midway into the generation wizard since I've already selected my source, target, and objects. I selected to create my objects (option of create, replace, and alter), opted not to create a script, and just told the wizard to finish. And, voila! Once I opened up the database navigator, there were my tables, all set up and ready to go for me. But here was the catch.

When you follow the steps I've just shown you, it creates the physical structure you designed but nothing else.

So for example, if you take a look here at one of the tables I created you will note that the primary key of the table, ID, is a sequence generated primary key that is populated by a BEFORE INSERT trigger. When I went to test data input with my newly created ADF business components I began getting errors because these weren't present. Luckily this was a simple problem to resolve.

All I had to do was to slide back over to my application navigator, highlight the sequences and triggers that I wanted (Ctrl-clicking my way down the list), and then right-click on them and select Generate To->[database connection name].

This then created the necessary sequences and triggers for me and life was grand. A simple thing, but something that was obviously easy to overlook even after doing it so many times. Luckily since I was using JDev I was able to identify, resolve, and verify my fix in less time than it took me to write this post!

Translating Display Values in ADF Rich Client LOVs


So I was working on a sample app I've been developing and came across an issue with getting a LOV to operate like I had expected it to. So, here is the db diagram of the tables involved. I have the standard ADF BC objects associated with this where I have the type table describing the various named types associated with the numerical id that is held in the TYPE_ID on the main component. So, on the MoveView I went ahead and created an LOV which defines the expected mapping of the ids of the TYPE_ID to the names described on the TYPE table.



So here you see the configuration of the LOV on the MoveView. Now, since the default UI hint is set as a choice list, if I just drop the view on a page it renders this by default as a selectOneChoice tag which is fine. However, if I go ahead and drop the attribute type_id directly from the data control palette I'm prompted with two options from the LOV context menu of ADF LOV Input or ADF LOV Choice List. The problem was introduced when I selected the ADF LOV Choice List. This creates as the rendering tag an "Input Combobox List of Values" which is bound to the LOV model as expected.






So here you can see the different renderings of those controls, both based on the LOV model. The problem I ran into with the control created by dragging the attribute directly from the data control palette is obvious. It lists the type names as desired instead of the type_id which is the actual table data, but once selected, the value that shows up in the collapsed control is the numerical backing value which isn't what I wanted. Thanks to Shays help we were able to come up with a simple (if perhaps not the ideal) workaround. We edited the MoveView, adding the Type table as a contributing entity and then added the name and id fields from the Type table as attributes of the MoveView. We then created a LOV definition on the newly included Name attribute.




So nothing really astonishing in creating this LOV. We then went and dropped the name attribute from the datacontrol palette to the page and dropped it as the aforementioned: "List of Values -> ADF LOV Choice List" which creates the InputComboboxListOfValues we saw before. We then went back into view object editor for the MoveView and made the TypeId attribute dependent on the Name attribute we just brought in from the Type entity. By doing this, when the Name attribute gets updated, the associated Type value will be applied. To tie this all together in the UI, we added the Name LOV control as a PartialTrigger on the TypeId control so that when we updated the Name, the TypeId control would also refresh with the appropriate data. This was mostly done for testing purposes as the Name control that we were creating was there to replace the need for the TypeId based control but we wanted to see that the associated TypeId value was indeed being set when the Name control was used. In the tests it worked perfectly! Thanks to Shay for his assistance getting this worked out.

Saturday, May 29, 2010

New Harware on the way!

For those of you who have followed my blog regularly, you know that I have always been into working with new and exciting hardware and seeing what I can do with it utilizing the Oracle product stack. From my first simple web server installation to host our first web site, to the full sized rack packed with enterprise hardware (SUN E450s, E420s, dell blades, load balancer, etc).

Well, I've moved in a new direction. Short of getting Oracle to lend me an Exadata machine I don't think I can go much further in the "big iron" direction, so interestingly I've been pointed in the "portable power" direction. I'm looking for the most power I can pack in a small package.

So, after reading through a bunch of reviews I settled on a boutique hardware builder named "Maingear" located out of New Jersey. Going on their site reminded me of any of the major hardware organizations with one exception, instead of having a never-ending list of different chassis selections, they focused on a select list of machines, and when it came to component selection, even the least expensive machines utilized name brand components (Intel, AMD, ATI, etc).

I ended up selecting their x-cube chassis as we are looking for portable power, this is an interesting small form factor chassis but I ended up being able to load it with components that would normally be in a full sized chassis. I had the option of loading it with 16gb of ram, the Intel i7 quad-core processors, dual 2tb drives in a RAID configuration, a bevy of video cards, and a lovely 1KW power supply to make sure all these components have the juice they need.

After I made the heart-wrenching decisions on what to take and what to cut, I placed my order. Usually, that would be where most new machine experiences would stop until it arrived, but Maingear has been unreal with their customer support. I have actually been able to speak with the person that is going to be building my machine! On top of that, I have been in a bit of a time crunch and their customer service has been something that I can't even describe.

As a quote from one of my email exchanges with a Maingear team member reads: "As a smaller company, we still have that “passion” for perfection, competitive spirit and belief in customer satisfaction".


If the machine itself gets half the attention that I have gotten as the customer, I can't wait to open it up and see what it can do when I load the Fusion stack on it.

Stay Tuned!

Wednesday, May 26, 2010

ADF Library vs Normal Jar?

Quick little link to another blog entry talking about the simple difference between an ADF Library jar and a normal Java jar file.

http://vtkrishn.wordpress.com/2010/05/04/how-normal-jar-library-is-different-from-adf-library/

Enjoy!
-Shaun

Tuesday, April 6, 2010

Oracle Iron Man 2 Promo video

Relaxing after presenting the Orange County OTN Developers Day session and saw this come on TV. First time I've seen an Oracle commercial on TV even if it is tied to the upcoming Iron Man movie (which itself looks mighty cool)...

http://link.brightcove.com/services/player/bcpid1640183659?bctid=73931620001

Wednesday, March 17, 2010

Nothing like being on the other side of the table...

So anyway, I became aware today that the latest version of FireFox (3.6) which is being pushed via FF's auto-update mechanism right now is known to break drag-and-drop functionality in ADF Faces 11g. This is due to the total removal (without a deprecation phase first) of an API which the FF developers didn't like but ADF Faces and Trinidad relied on.

Development has fixed the problem we'll just need to wait on a decision on method of delivery (one-off, next patchset, etc). There are several announcements regarding this on other Oracle controlled sites (OTN, et al.)

Monday, March 15, 2010

Upcoming Oracle Events

Just finishing up travel plans for upcoming events. I'll be presenting at the OTN Developer Days in Irvine, CA on the 6th of April, information can be found here for the Irvine event and others. Also will be at Collaborate 2010 in Las Vegas from April 18th to the 22nd, information on that can be found here.

On the materials front, I just completed the inaugural session for the new "ADF Insider" series. In this series of extended web sessions (avg 30mins - 1hr long) the ADF expert team, and potentially some recognized industry experts will provide details on some of the more advanced topics surrounding implementing utilizing the Oracle Application Development Framework. My desire with this project is to have a series of sessions that go a step further in providing information not addressed in existing documentation.

In this spirit, the first session covers how to integrate ADF with a SOA environment. Included in this are multiple hands-on demos covering how to expose ADF business components into the SCA, consuming SOA artifacts (webservices/composites) into an ADF web application, and finally how to create a custom "human task" (from the Oracle SOA Suite) activity interface.

You can find a link to the session here.