Thursday, May 3, 2007

Phobos And Data Access

The last few weeks I have been working on some Phobos applications internal to our company and trying to work out the best way to access databases for both data display uses and form usage requiring persistence. The Phobos team has produced a generator which produces all the tiers of code which you can then modify once you have run the generator. The only stipulation is that you have run the JPA wizard on your database and have produced the needed JPA jar by using Netbeans. The JPA Jar is easily produced with the Netbeans wizard if you have a new database and there doesn't happen to be any wrinkles. I accomplished the whole task for a sample app in about thirty minutes. Considering I started with nothing and when I was done, I had a database with tables, a persistence unit, application server code, and a rough web interface, I would say that the process is pretty impressive! The Netbeans and Phobos team have a done a great job.

However, there is more to life than roses. It is not so easy when working with legacy data. For instance, it is not uncommon to have data in at least a couple of different databases. If we need to pull data from MSSQL and MySql into the same application we may have a problem. I ran into a problem running the Netbeans Entity class wizard to generate my JPA jar. Most of the tables could not be used because the primary keys were not recognized by the wizard. This isn't necessarily a problem, it just means if you want to use JPA, you have to hand code the classes in Java. If you are using Phobos and you run into this and you do not know Java, you might have to weigh just using jdbc as you can then script the object directly and you do not have to write Java code.

Check out the Phobos JPA generator tutorial at https://phobos.dev.java.net/tutorials/jpagenerator/index.html

On another note, be sure to check out Roberto's blog and his speech he gave at the Web 2.0 conference. the link is http://weblogs.java.net/blog/robc/archive/2007/04/phobos_at_the_w.html.
Roberto is one of the Sun engineers working on Phobos. He details the impressive speed and features of Phobos. The Phobos team has done a great job.

Phobos has the potential to really take off for the average developer if it can continue to integrate into the application stack. The way I view it, is that it sits very well under the presentation layer and works very well as the free flowing glue. The challenge will be, can it wrap the layers below it to make it really easy for the developer working in the Phobos layer. This what Ruby on Rails has done and its usage is skyrocketing. There are many more advantages to the Phobos/Java platform than the rails obviously, but ease of use and productivity are what will make a platform take off.

0 comments: