Read Digital Edition


ADS BY GOOGLE
Top Three Links You Must Click On


Effective EJB: Make EJBs Work For You
"Java Development is at a Crossroads."

EJB 3.0 decreases the number of programming artifacts for developers to provide, eliminate, or minimize the callback methods that are required to be implemented, and reduces the complexity of the entity bean programming model and O/R mapping model. The following are the key new features of the EJB 3.0 specification.

  • An annotation-based EJB programming model: EJB 3.0 takes full advantage of the annotation-based programming model introduced in Java 5 (aka Tiger). In EJB 3.0, all kinds of enterprise beans are just POJOs. Annonations are used to define references, call backs, remote interfaces, create methods, etc. This makes programming much easier and the model is neat. Furthermore, it relieves the developer from the constrained framework implementation.
  • Support for POJO-like EJB development: EJB 3.0 supports POJO-like EJB. This means the EJB classes need not implement the corresponding interfaces. All that is required is to set an annotation for the compiler to understand the behavior of the class. This makes converting existing POJO services such as EJBs much easier.

    One of the problems with the earlier programming model was that EJB requires a whole lot of classes and descriptors. Starting EJB 3.0, there is no need for interfaces or deployment descriptors. All that is required is an EJB class (essentially a POJO) annotated adequately to provide the run-time information to the container.

  • The new persistence model for entity beans: In line with a new session bean model, entity beans in the EJB 3.0 specification are simple POJOs. Also, the EJBQL has been significantly changed to add much more functionality. Entity bean classes can be just like a plain Java Bean class, and all fields that are not marked with @Transient annotation are assumed to be persistent. The object relational mapping has changed from the abstract persistence schema model in earlier specifications to the Hibernate-inspired persistence model.
  • Testability outside the container: One of the main drawbacks of EJB architecture is that it cannot be tested outside of the managed environment. Initial drafts of EJB 3.0 specification had some thoughts about testability outside the container. However, this is still in draft stage and will be a very important addition to the specification if it comes through the final version.
Summary
EJB remains one of the most important and ambitious technologies in the J2EE world. The main goal of EJB is to standardize the enterprise middleware programming. As with all complex technologies, it is very prone to misuse and misunderstanding. The key to using EJB effectively and to its best potential is to identify the business context for EJB, evaluate the design decision, apply sound engineering principles, and finally, create effective EJB. Once care is taken to use EJB properly, it delivers the promise. If not handled properly, it can become a nightmare for you.

From the decision to use EJB to the production deployment, every step requires careful consideration, analysis, and discipline. This article has provided some guidelines for and has shown some potential gray areas in EJB development. However, time and again new antipatterns crop up and it is up to the architects, engineers, and developers to tame the problems.

EJB 3.0 is definitely a very good step towards easing EJB development, and not just on the coding part of it. Being able to write simple EJBs will help facilitate maintenance and lower risks in production. J2EE, and EJB by extension, is now the default development platform for enterprise applications.

Effective use of EJB lies in understanding that EJB is just an extension to J2EE capabilities. A J2EE application does not necessarily use EJB. However, when there is a need, EJB can provide significant advantages to the application. The key to developing effective EJB is to move away from the religious feelings you may have about EJB and evaluate the technology in its own capacity without the hype surrounding it. This will help you make better choices, use EJB cleverly, and finally, to build Effective EJB.

Hope this helps!

References

About Shankar Itchapurapu
Shankar Itchapurapu is a software engineer at BEA Systems, India. He holds a Master's degree in Computer Applications. You can e-mail Shankar at shankar.itchapurapu@gmail.com.

In order to post a comment you need to be registered and logged in.

Register | Sign-in

Reader Feedback: Page 1 of 1

test

test

Effective EJB. Java development is at a crossroads. The open standards have done lot of good for the Java platform and language, but they have brought in some problems too. Developers are often drenched in the complexities that surround Java development. Worse yet, these complexities are so overwhelming that the actual business problems take a back seat.


  Subscribe to our RSS feeds now and receive the next article instantly!
In It? Reprint It! Contact advertising(at)sys-con.com to order your reprints!
Subscribe to the World's Most Powerful Newsletters

ADS BY GOOGLE
Behaving like it’s got a future, Sun Monday put out what it calls a significant new version of Virtu...
InformationWeek stumbled on a Microsoft patent application dating back to 2006 deceptively titled “M...
Berlin-based ThinPrint AG, the printer virtualization house, thinks it’s got a cloud solution for th...
IBM has acquired Guardium, a seven-year-old subsidiary of Israel’s Log-On Software transplanted to M...
But on the web, access to services is implicit in the fact that the business is offering the service...
We talk a lot about social media on Marketing Trenches. And for good reason – Social media seems to...
Oracle has offered to cordon off MySQL inside a combined Oracle-Sun to get the European Commission t...
Intel has put out its promised beta SDK for Windows (C and C++) and Moblin (C) developers working on...
The second set of charges filed last week against Indian outsourcer Satyam Computer Services founder...
Gartner told Reuters that it overestimated how many PCs Acer shipped in the last seven quarters by a...
Gartner is buying ~$40 million-a-year AMR Research Inc for close to $64 million in cash. AMD special...
Singed by user reaction to its plans to up the price of its support contracts, SAP Tuesday postponed...
Apparently Google Gears ain’t gonna stick around that long. Google Apps will eventually get their of...
Office Web Apps, Microsoft’s answer to Google Apps, are supposed to be out sometime in June along wi...
Gartner thinks the server business has stopped sliding into the abyss. Third-quarter sales weren’t a...
Oracle seems to have divided the open source ranks over the MySQL delay it’s having closing its acqu...
The Korean government is going to sink around $172 million into cloud computing next year under a st...
We hear – well, you know how people talk – that Oracle has been quietly meeting with the European Co...
In response to Opera’s complaints Microsoft has reportedly modified the proposed ballot screen that’...
Acer’s got its heart set on being first out with an official Chrome netbook sometime in the second h...