Welcome!

Weblogic Authors: Yeshim Deniz, Elizabeth White, Michael Meiner, Michael Bushong, Avi Rosenthal

Related Topics: Weblogic

Weblogic: Article

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

More Stories By Shankar Itchapurapu

Shankar Itchapurapu is a software engineer at Oracle in India. He holds a Master's degree in Computer Applications. You can e-mail Shankar at [email protected]

Comments (3) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
shankar 12/15/05 06:34:12 AM EST

test

shankar 12/15/05 06:34:01 AM EST

test

Java Developer's Journal News Desk 10/17/05 01:27:02 PM EDT

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.

IoT & Smart Cities Stories
The deluge of IoT sensor data collected from connected devices and the powerful AI required to make that data actionable are giving rise to a hybrid ecosystem in which cloud, on-prem and edge processes become interweaved. Attendees will learn how emerging composable infrastructure solutions deliver the adaptive architecture needed to manage this new data reality. Machine learning algorithms can better anticipate data storms and automate resources to support surges, including fully scalable GPU-c...
Machine learning has taken residence at our cities' cores and now we can finally have "smart cities." Cities are a collection of buildings made to provide the structure and safety necessary for people to function, create and survive. Buildings are a pool of ever-changing performance data from large automated systems such as heating and cooling to the people that live and work within them. Through machine learning, buildings can optimize performance, reduce costs, and improve occupant comfort by ...
The explosion of new web/cloud/IoT-based applications and the data they generate are transforming our world right before our eyes. In this rush to adopt these new technologies, organizations are often ignoring fundamental questions concerning who owns the data and failing to ask for permission to conduct invasive surveillance of their customers. Organizations that are not transparent about how their systems gather data telemetry without offering shared data ownership risk product rejection, regu...
René Bostic is the Technical VP of the IBM Cloud Unit in North America. Enjoying her career with IBM during the modern millennial technological era, she is an expert in cloud computing, DevOps and emerging cloud technologies such as Blockchain. Her strengths and core competencies include a proven record of accomplishments in consensus building at all levels to assess, plan, and implement enterprise and cloud computing solutions. René is a member of the Society of Women Engineers (SWE) and a m...
Poor data quality and analytics drive down business value. In fact, Gartner estimated that the average financial impact of poor data quality on organizations is $9.7 million per year. But bad data is much more than a cost center. By eroding trust in information, analytics and the business decisions based on these, it is a serious impediment to digital transformation.
Digital Transformation: Preparing Cloud & IoT Security for the Age of Artificial Intelligence. As automation and artificial intelligence (AI) power solution development and delivery, many businesses need to build backend cloud capabilities. Well-poised organizations, marketing smart devices with AI and BlockChain capabilities prepare to refine compliance and regulatory capabilities in 2018. Volumes of health, financial, technical and privacy data, along with tightening compliance requirements by...
Predicting the future has never been more challenging - not because of the lack of data but because of the flood of ungoverned and risk laden information. Microsoft states that 2.5 exabytes of data are created every day. Expectations and reliance on data are being pushed to the limits, as demands around hybrid options continue to grow.
Digital Transformation and Disruption, Amazon Style - What You Can Learn. Chris Kocher is a co-founder of Grey Heron, a management and strategic marketing consulting firm. He has 25+ years in both strategic and hands-on operating experience helping executives and investors build revenues and shareholder value. He has consulted with over 130 companies on innovating with new business models, product strategies and monetization. Chris has held management positions at HP and Symantec in addition to ...
Enterprises have taken advantage of IoT to achieve important revenue and cost advantages. What is less apparent is how incumbent enterprises operating at scale have, following success with IoT, built analytic, operations management and software development capabilities - ranging from autonomous vehicles to manageable robotics installations. They have embraced these capabilities as if they were Silicon Valley startups.
As IoT continues to increase momentum, so does the associated risk. Secure Device Lifecycle Management (DLM) is ranked as one of the most important technology areas of IoT. Driving this trend is the realization that secure support for IoT devices provides companies the ability to deliver high-quality, reliable, secure offerings faster, create new revenue streams, and reduce support costs, all while building a competitive advantage in their markets. In this session, we will use customer use cases...