Welcome!

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

Related Topics: Weblogic

Weblogic: Article

CMP 2.0, EJBGen, and Builder Make EJBs Easy!

CMP 2.0, EJBGen, and Builder Make EJBs Easy!

EJBs have always been the best way to ensure that your applications were portable and would leverage all the optimizations of the J2EE server. Now they are also easy to build. With the release of WebLogic Platform 7.0, you can create EJBs in record time. At the center of this revolution is Container Managed Persistence 2.0, which allows WebLogic to build tools that remove the layers from EJB development. Relations, the standard EJB query language, and JavaBean-like properties all contribute to this new age. Since EJB 1.0 was introduced it's had a rap as a difficult, complex technology to implement - probably for good reason. This release of WebLogic is targeted at changing that. Going forward there will be more and more tools to help you develop EJBs painlessly and efficiently.

The biggest tool for the developer is EJBGen. EJBGen gives you the power to create an entire EJB, including home and remote (and/or local) interfaces and deployment descriptors, by creating a single implementation file marked up with special JavaDoc tags. This drastically increases the maintainability of the system and makes it simple for developers to quickly generate the EJBs needed for a project. Listing 1 demonstrates this for you.

The relatively small amount of source code and description translates directly into all the pieces that make up an EJB component JAR. To generate the code, simply use EJBGen, which runs as a JavaDoc doclet:

javadoc -doclet weblogic.tools.ejbgen.EJBGen -d targetDir FooEJB.java

In the targetDir you'll find the Java source and the deployment descriptors for all the components that make up your EJB. Compile and JAR the files to deploy to the server. It's really as simple as that.

WebLogic Builder is the biggest time-saving tool if you've already written your EJBs and just need to configure and deploy them. The Builder tool will crack open .jar, .ear, and .war files or work on open directory structures to configure the deployment descriptors for all your components. Not only that, using an internal tool called DDInit (we provide Ant tasks to run it outside the Builder), you can take loose classes and turn them into components.

Let's say you don't want to use EJBGen or are given a set of interfaces for the EJB. Simply write the implementation beans compile, and point the Builder at your directory. Not only will it discover what kinds of beans you have, it will also generate defaults for all the deployment descriptors, including all the relations between beans. It's that simple. With a bean that is mostly for data, you can get away with writing as little as a couple of interfaces and one abstract implementation class with no methods!

There are also a couple of tools in the works that can save you time. Expect to see SQL2EJB and ReverseEJBGen in a follow-on release. SQL2EJB does what you might imagine: given a database with a reasonable schema (it's best if it has all of its foreign and primary keys properly marked), it will generate a set of EJBGen source classes that can then be EJBGen'd, compiled, and deployed to a server. Even better, since WebLogic supports dynamic table creation, you can deploy it to another database that doesn't already have the schema for testing or development purposes. This is the type of tool that has only become reasonable with the introduction of relations to the EJB specification. ReverseEJBGen does what you might imagine: given an EJB component, or set of components, it will generate an EJBGen source file that includes all the information found in the deployment descriptors. It will consolidate all those disparate files down to one file that is the final word on an EJB. Also, it lets you use the Builder tool to edit a deployed EJBGen'd component, change the deployment descriptors, and then convert back to the original format.

Expect to see these types of tools integrated with products like WebLogic Builder to make developing products for the WebLogic Platform as simple as possible.

More Stories By Sam Pullara

Sam Pullara has been a software engineer at WebLogic since 1996 and has contributed to the architecture, design, and implementation of many aspects of the application server.

e-mail: [email protected]

Comments (0)

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.


IoT & Smart Cities Stories
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...
Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life settlement products to hedge funds and investment banks. After, he co-founded a revenue cycle management company where he learned about Bitcoin and eventually Ethereal. Andrew's role at ConsenSys Enterprise is a mul...
In his general session at 19th Cloud Expo, Manish Dixit, VP of Product and Engineering at Dice, discussed how Dice leverages data insights and tools to help both tech professionals and recruiters better understand how skills relate to each other and which skills are in high demand using interactive visualizations and salary indicator tools to maximize earning potential. Manish Dixit is VP of Product and Engineering at Dice. As the leader of the Product, Engineering and Data Sciences team at D...
Dynatrace is an application performance management software company with products for the information technology departments and digital business owners of medium and large businesses. Building the Future of Monitoring with Artificial Intelligence. Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more busine...
Nicolas Fierro is CEO of MIMIR Blockchain Solutions. He is a programmer, technologist, and operations dev who has worked with Ethereum and blockchain since 2014. His knowledge in blockchain dates to when he performed dev ops services to the Ethereum Foundation as one the privileged few developers to work with the original core team in Switzerland.
Whenever a new technology hits the high points of hype, everyone starts talking about it like it will solve all their business problems. Blockchain is one of those technologies. According to Gartner's latest report on the hype cycle of emerging technologies, blockchain has just passed the peak of their hype cycle curve. If you read the news articles about it, one would think it has taken over the technology world. No disruptive technology is without its challenges and potential impediments t...
If a machine can invent, does this mean the end of the patent system as we know it? The patent system, both in the US and Europe, allows companies to protect their inventions and helps foster innovation. However, Artificial Intelligence (AI) could be set to disrupt the patent system as we know it. This talk will examine how AI may change the patent landscape in the years to come. Furthermore, ways in which companies can best protect their AI related inventions will be examined from both a US and...
Bill Schmarzo, Tech Chair of "Big Data | Analytics" of upcoming CloudEXPO | DXWorldEXPO New York (November 12-13, 2018, New York City) today announced the outline and schedule of the track. "The track has been designed in experience/degree order," said Schmarzo. "So, that folks who attend the entire track can leave the conference with some of the skills necessary to get their work done when they get back to their offices. It actually ties back to some work that I'm doing at the University of San...
When talking IoT we often focus on the devices, the sensors, the hardware itself. The new smart appliances, the new smart or self-driving cars (which are amalgamations of many ‘things'). When we are looking at the world of IoT, we should take a step back, look at the big picture. What value are these devices providing. IoT is not about the devices, its about the data consumed and generated. The devices are tools, mechanisms, conduits. This paper discusses the considerations when dealing with the...
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...