Wednesday, January 6, 2010

GlassFish embeddded, And test driven development

So save anyone the pain of getting this working
Here is our EJB sample that uses GlassFish Embedded and JavaDB for unit testing

https://svn.kenai.com/svn/enerwebsample~source-code-repository/RefSampleEJBApp

main project : http://kenai.com/projects/enerwebsample

Comments , patches , complaints welcome.

regards
Richard.

Tuesday, December 22, 2009

In a quest to not just complain, but do something

Recently I have been seen on the mailing list on how I could not use GlassFish 3 because my favorite JSF 1 implementation Icefaces 1.x does not work on GlassFish 3 and there are not other stable JSF 2 implementations besides the reference.

I struggled and struggled to get JSF 2 working in NetBeans 6.8 and Maven - using a separated business logic layer and web layer. My company Enerweb is also embarking on a campain to supply sample applications so developers code the same way and projects can be kick started fast.

Enerweb Java Samples was born http://kenai.com/projects/enerwebsample

Sunday, December 20, 2009

Another tale of how Richard does JavaEE the hard way

Over the last few weeks I have been hacking away trying to create a nice CRUD of some simple tables. And being a old developer I feel the need to get into the guts of things and do thing the 'right way'.

So I create Entity Beans in NetBeans 6.8
Then create Session Bean facades from the JPA Entity Beans
Then furiously start coding backing beans , afraid of using the create JSF 2 pages from Entities wizard because I think it's going to tightly couple my JSF to my JPA Entity beans.
After digging around , complaining and thinking a whole weekend on how this is going to take a full day to create a simple CRUD for three tables, I decided how I would go about this.

I would create the Entity Beans from the existing Database
Create the Session Beans facade from the Entity Beans
Then create the JSF 2 pages from the Entity Classes.
Then hack the JSF controllers generated by NetBeans to use the facade instead. (Will take half a day)

To my amazement I see the NetBeans 'create JSF pages from Entity Beans wizard' does this all for me. And holy cow it seems to allow for lazy loading, so I can handle my 1.2 1000 million record table. What an amazing pattern!

My hat goes off to the NetBeans people. You saved me so much time!

Friday, December 18, 2009

My JSF 2 quest. Need something that works and looks pretty

I thought I would share in my battle against JSF2.


A bit of background, I've created a few applications with Icefaces 1.x and JSF 1.x in the past and wow they are great.
I've had so many complements from .NET and Python developers alike.
Have a look at these wonderful components http://component-showcase.icefaces.org/

But now GlassFish 3.0 and JSF 2 is here and the Icefaces 1.x components just don't work...
(I understand why, I'm just commenting)

So what is my natural course of action , Download Icefaces 2.0.0 Alpha 1 and wow, what a struggle.
Then I try PrimeFaces 2.0.0 RC, and does not work in GlassFish 3. (I think there is a bug logged)


So I went back to the reference implementation. It works, but it seems missing a lot of bells and whistles and where are the demos to show the components.
All I see is some rough samples that I could never use in a real application.
(Have a look at the IceFaces 1.x show case, compared to the JSF 2 reference samples)

So now I have OpenFaces 2.0 EA2 working.
It works just like the demo on the web site : http://openfaces.org/demo/overview/homepage.jsf


I'm off with my battle axe and OpenFaces, and hopefully I can dazzle a project manager on Monday with Java-EE 6.