December 19, 2006

Model-Driven Upgrade from EJB 2.x to EJB 3

One of the most promising reasons to use an model-driven approach to software engineering was the ease of broad architectural migrations. Now, as EJB 3 is final, Java 5 runtimes are available for the OSes our customers prefer, and app servers are also available, we can get the chance of migrating the whole software architecture to the current version of our middleware standard.

The benefits of EJB 3 are:

  • instead of requiring 4 artefacts per entity EJB we require 1.

  • instead of requiring 6 artefacts (in our architecture) per session EJB we require 1

In our system we've got approximately 500 entity beans and 70 session beans. So, with EJB 3 we get rid of about 1'500 classes for our entities and about 350 classes for our session beans. Resulting in 1'850 saved classes!

Step 1

Because there's no budget for a solid architectural renovation we choose to get rid of as many classes as possible without changing our software architecture. In the first small step we'll keep our data transfer objects as they are, although we could get rid of them easily with JPA, the latest Java persistent mechanism. We still use data access objects in addition to the entity beans for complex queries.

Step 2

Afterwards we inline the data access objects' functionality into the JPA-entities. JPA has a very powerful mechanism for queries, which makes our DAOs obsolete.

Step 3

If the backend is streamlined, we'll have saved more than 2'200 classes. In the end we'll remove our data transfer objects and replace them with the entities itself. While this could be quite a problem in some architectures it's quite seemless in our approach.
That should lead to savings of about 3'200 classes in total! - That's quite a big deal... (and more than 50% of our classes...)

The next post will provide some information on our approach.

Posted by Phillip Ghadir at December 19, 2006 3:36 PM