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."

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.

The J2EE specification provides a lot of APIs, standards, and open ends that allow architects, designers, and developers to build superior enterprise systems. Care must be taken to engage in the balancing act of choosing the right technology.

Technology development has created more confusion for the developers (unless developers are versatile) rather than helping them to resolve the issues. Often, architects and developers spend most of their time supporting their chosen framework instead of concentrating on the business problem in hand.

This article discusses the techniques involved in designing and developing superior J2EE applications using the Enterprise Java Beans (EJB) specification. While the article does not intend to show how to use EJB, I'll discuss the various pitfalls in EJB development and essentially focus on the real-world antipatterns that sneak into your development.

Learning things the hard way is nice, but due to the ever-shortening development cycles, it is smarter to learn from mistakes made by other people. Having a comprehensive understanding of where the dangers are will help one to take a proactive strategy, which is precisely the theme of this article. We will start with the EJB Context in J2EE applications and then discuss some potential dangers that exist in EJB development.

Effective EJB Decision
Software is an engineered art and the engineering is continuous. With each exciting technology such as the EJB specification, weary engineering minds tend to adopt the exciting new technology in hurry. This is one reason most EJB projects fail. Often they fail so badly that they finish at point of no return. It would be wiser to engineer the choice of EJB rather than to embrace it just because it's a hot, sexy, and promising technology.

With regard to component architecture for building distributed, transactional, and persistent business solutions, the decision to use EJB in software projects demands a careful analysis and proactive planning with sound engineering practices.

Choosing Unwisely (A Golden Hammer for a Fly)
"When you have a hammer in your hand, everything looks a nail." This phrase befits most EJB choices. EJB may not be the best suited for most projects simply because the following are true:

  • You have already paid for the server and have an EJB container ready for use
  • You are doing enterprise Java development (is your business really an enterprise?)
  • You want a fully portable architecture (is EJB really portable?)
  • You have a container and EJB allows you to delegate most of the jobs to the container (this would reduce the development cost/time and ensure fast time to market)
Solution (Choose Wisely)
Figure 1 shows the trade-off between project size and cost for a simple POJO (Plain Old Java Objects) solution and an EJB solution.

Choosing an EJB Solution

  • Strive to achieve the break-even point quickly
  • Choose EJB if your project is complex (as seen in the graph, EJB projects start complex and expensive, but ramp up more slowly with project size)
  • Choose EJB if the services provided the EJB container are needed for the business; in other words, choose EJB if the answer is YES to the following questions:
    - Do your components need to be distributed?
    - Do you need to handle global transactions?
    - Do you have security requirements at the business-component level?
    - Do you need a persistence framework that rund inside a managed environment?
    - Does your application need high scalability?
Not Everything Is an EJB
The most often seen misinterpretation of EJB among junior- and intermediate-level users is that when you use EJB, every component is an EJB.

No. This is rarely true. A component or a subsystem may be a true EJB candidate while others can be just POJOs. This mixed-mode design is tough, but engineering the design decisions at each component/subsystem level makes life easier during the roll out.

Coarse-Grained and Fine-Grained Services
One key aspect of choosing EJB at the subsystem level is to understand the EJB services. EJB components come in two flavors: a set of work horse components called session beans and a set of persistence components called entity beans. Session beans are generally coarse-grained services that take advantage of a container's ability to provide distribution, transaction management, and security. For a non-EJB component, the implementation of these services is the developer's responsibility. Components that make heavy use of these services are often the right candidates for session EJBs.

The EJB specification mandates support for fine-grained persistence services through entity beans. Each entity bean can itself be again distributed, transaction aware, and secure and hence there is a complex mixture of fine-grained and coarse-grained services. Often, this mixture makes entity bean components very difficult to manage. If a component needs to be just persistent, there is seldom a need for the component to be an EJB. Other popular, lightweight persistence frameworks exist (e.g., JDO, Hibernate etc.) that are easier to maintain.

Effective EJB Interfaces
One of the key aspects of EJB design is creating interfaces. Interfaces are the lingua franca of the EJB components. They serve as a vehicle to expose the services provided by the EJB component to the external world. Poor interface design would lead to EJBs that are hard to maintain and change.

Considerations for Interface Design
What is the size of your network pipe? At the end of the day, EJB is RMI. It involves remote procedure calls. The location transparency will just add some more network complexity. The EJB calls involve significant marshalling and unmarshalling of parameters over the network. Care should be taken when designing the remote interfaces. If you have a big pipe and can stream large data quickly through it, then the interfaces can be coarse grained. On the other hand, if you have a smaller bandwidth, then you're probably better off having finer-grained interfaces and lightweight parameter marshalling.

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.

@ThingsExpo Stories
Organizations planning enterprise data center consolidation and modernization projects are faced with a challenging, costly reality. Requirements to deploy modern, cloud-native applications simultaneously with traditional client/server applications are almost impossible to achieve with hardware-centric enterprise infrastructure. Compute and network infrastructure are fast moving down a software-defined path, but storage has been a laggard. Until now.
Digital Transformation is much more than a buzzword. The radical shift to digital mechanisms for almost every process is evident across all industries and verticals. This is often especially true in financial services, where the legacy environment is many times unable to keep up with the rapidly shifting demands of the consumer. The constant pressure to provide complete, omnichannel delivery of customer-facing solutions to meet both regulatory and customer demands is putting enormous pressure on...
The best way to leverage your CloudEXPO | DXWorldEXPO presence as a sponsor and exhibitor is to plan your news announcements around our events. The press covering CloudEXPO | DXWorldEXPO will have access to these releases and will amplify your news announcements. More than two dozen Cloud companies either set deals at our shows or have announced their mergers and acquisitions at CloudEXPO. Product announcements during our show provide your company with the most reach through our targeted audienc...
DXWorldEXPO LLC announced today that All in Mobile, a mobile app development company from Poland, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. All In Mobile is a mobile app development company from Poland. Since 2014, they maintain passion for developing mobile applications for enterprises and startups worldwide.
"Akvelon is a software development company and we also provide consultancy services to folks who are looking to scale or accelerate their engineering roadmaps," explained Jeremiah Mothersell, Marketing Manager at Akvelon, in this SYS-CON.tv interview at 21st Cloud Expo, held Oct 31 – Nov 2, 2017, at the Santa Clara Convention Center in Santa Clara, CA.
JETRO showcased Japan Digital Transformation Pavilion at SYS-CON's 21st International Cloud Expo® at the Santa Clara Convention Center in Santa Clara, CA. The Japan External Trade Organization (JETRO) is a non-profit organization that provides business support services to companies expanding to Japan. With the support of JETRO's dedicated staff, clients can incorporate their business; receive visa, immigration, and HR support; find dedicated office space; identify local government subsidies; get...
The current age of digital transformation means that IT organizations must adapt their toolset to cover all digital experiences, beyond just the end users’. Today’s businesses can no longer focus solely on the digital interactions they manage with employees or customers; they must now contend with non-traditional factors. Whether it's the power of brand to make or break a company, the need to monitor across all locations 24/7, or the ability to proactively resolve issues, companies must adapt to...
"We view the cloud not as a specific technology but as a way of doing business and that way of doing business is transforming the way software, infrastructure and services are being delivered to business," explained Matthew Rosen, CEO and Director at Fusion, in this SYS-CON.tv interview at 18th Cloud Expo (http://www.CloudComputingExpo.com), held June 7-9 at the Javits Center in New York City, NY.
DXWorldEXPO LLC announced today that the upcoming DXWorldEXPO | CloudEXPO New York event will feature 10 companies from Poland to participate at the "Poland Digital Transformation Pavilion" on November 12-13, 2018.
As data explodes in quantity, importance and from new sources, the need for managing and protecting data residing across physical, virtual, and cloud environments grow with it. Managing data includes protecting it, indexing and classifying it for true, long-term management, compliance and E-Discovery. Commvault can ensure this with a single pane of glass solution – whether in a private cloud, a Service Provider delivered public cloud or a hybrid cloud environment – across the heterogeneous enter...
DXWorldEXPO LLC announced today that ICC-USA, a computer systems integrator and server manufacturing company focused on developing products and product appliances, will exhibit at the 22nd International CloudEXPO | DXWorldEXPO. DXWordEXPO New York 2018, colocated with CloudEXPO New York 2018 will be held November 11-13, 2018, in New York City. ICC is a computer systems integrator and server manufacturing company focused on developing products and product appliances to meet a wide range of ...
More and more brands have jumped on the IoT bandwagon. We have an excess of wearables – activity trackers, smartwatches, smart glasses and sneakers, and more that track seemingly endless datapoints. However, most consumers have no idea what “IoT” means. Creating more wearables that track data shouldn't be the aim of brands; delivering meaningful, tangible relevance to their users should be. We're in a period in which the IoT pendulum is still swinging. Initially, it swung toward "smart for smart...
Major trends and emerging technologies – from virtual reality and IoT, to Big Data and algorithms – are helping organizations innovate in the digital era. However, to create real business value, IT must think beyond the ‘what’ of digital transformation to the ‘how’ to harness emerging trends, innovation and disruption. Architecture is the key that underpins and ties all these efforts together. In the digital age, it’s important to invest in architecture, extend the enterprise footprint to the cl...
Coca-Cola’s Google powered digital signage system lays the groundwork for a more valuable connection between Coke and its customers. Digital signs pair software with high-resolution displays so that a message can be changed instantly based on what the operator wants to communicate or sell. In their Day 3 Keynote at 21st Cloud Expo, Greg Chambers, Global Group Director, Digital Innovation, Coca-Cola, and Vidya Nagarajan, a Senior Product Manager at Google, discussed how from store operations and ...
Headquartered in Plainsboro, NJ, Synametrics Technologies has provided IT professionals and computer systems developers since 1997. Based on the success of their initial product offerings (WinSQL and DeltaCopy), the company continues to create and hone innovative products that help its customers get more from their computer applications, databases and infrastructure. To date, over one million users around the world have chosen Synametrics solutions to help power their accelerated business or per...
Dion Hinchcliffe is an internationally recognized digital expert, bestselling book author, frequent keynote speaker, analyst, futurist, and transformation expert based in Washington, DC. He is currently Chief Strategy Officer at the industry-leading digital strategy and online community solutions firm, 7Summits.
We are seeing a major migration of enterprises applications to the cloud. As cloud and business use of real time applications accelerate, legacy networks are no longer able to architecturally support cloud adoption and deliver the performance and security required by highly distributed enterprises. These outdated solutions have become more costly and complicated to implement, install, manage, and maintain.SD-WAN offers unlimited capabilities for accessing the benefits of the cloud and Internet. ...
In an era of historic innovation fueled by unprecedented access to data and technology, the low cost and risk of entering new markets has leveled the playing field for business. Today, any ambitious innovator can easily introduce a new application or product that can reinvent business models and transform the client experience. In their Day 2 Keynote at 19th Cloud Expo, Mercer Rowe, IBM Vice President of Strategic Alliances, and Raejeanne Skillern, Intel Vice President of Data Center Group and ...
Bill Schmarzo, author of "Big Data: Understanding How Data Powers Big Business" and "Big Data MBA: Driving Business Strategies with Data Science," is responsible for setting the strategy and defining the Big Data service offerings and capabilities for EMC Global Services Big Data Practice. As the CTO for the Big Data Practice, he is responsible for working with organizations to help them identify where and how to start their big data journeys. He's written several white papers, is an avid blogge...
Founded in 2000, Chetu Inc. is a global provider of customized software development solutions and IT staff augmentation services for software technology providers. By providing clients with unparalleled niche technology expertise and industry experience, Chetu has become the premiere long-term, back-end software development partner for start-ups, SMBs, and Fortune 500 companies. Chetu is headquartered in Plantation, Florida, with thirteen offices throughout the U.S. and abroad.