Friday, March 23, 2007

Oracle Acquires Tangosol

Oracle announced that it will acquire Tangosol. Congrats Cameron and gang and welcome to Oracle!

Wednesday, March 21, 2007

Using @EJB annotation across different ejb-jar module

I got some questions from customers on how to use @EJB annotation to inject instance of a session packaged in another EJB-JAR. In this blog entry I will outline how to do that.

Let us assume that you have two stateless beans SessionEJB1 and SessionEJB2 and those are packaged in two different EJB modules ejb1-ejb.jar and ejb2-ejb.jar respectively. You want to use inject SessionEJB2 (in ejb2-ejb.jar) from SessionEJB1 (packaged in ejb1-ejb.jar) then you can just do the following:

@Stateless
public class SessionEJB1Bean implements SessionEJB1, SessionEJB1Local {
@EJB
testejb2.SessionEJB2 ejb2;

This works great in OC4J 10.1.3.1.

Optionally you may do as follows, following the ejb-link convention that we used in EJB 2.

@EJB(beanName="ejb2-ejb.jar#SessionEJB2Bean",
beanInterface=testejb2.SessionEJB2.class)
testejb2.SessionEJB2 ejb2;


I've seen this problem when I deploy from JDeveloper. If you are using JDeveloper 10.1.3.1 and getting NameNotFoundException then make sure that your dependent ejb-jar module does package duplicate classes. By default when you declare a dependency on another project the classes are automatically packaged in the dependent jar e.g. ejb1-ejb.jar in our case. You have to verify it using the deployment profile for your EJB module. Make sure that you have unchecked the classes by selecting filters.

Hope this works for you!

Tuesday, March 20, 2007

EJB 3 In Action goes to press: eBook now available!

EJB 3 In Action went to press late last week. The e-Book has been published at the Manning web site . Print copies of the book will be available at Manning web site for order and hit the shelves at the brick and mortar stores such as Barnes and Noble and Borders in another 2-3 weeks.

Two sample chapters (chapter 1 and 11) are available free at the book site. You can take a look at the preface, table of contents and index.

You can order the book from Amazon.com at http://www.amazon.com/Ejb-3-Action-Debu-Panda/dp/1933988347

The global sites at Amazon screwed up the listing and show two books. It was due to the change in ISBN. Note the correct ISBN is: 1-933988-34-7 and book is of 700 pages.

Here are links to the correct book at Amazon sites for few countries

Canada : http://www.amazon.ca/Ejb-3-Action-Debu-Panda/dp/1933988347

France : http://www.amazon.fr/Ejb-3-Action-Debu-Panda/dp/1933988347

Germany: http://www.amazon.de/Ejb-3-Action-Debu-Panda/dp/1933988347

Japan: http://www.amazon.jp/Ejb-3-Action-Debu-Panda/dp/1933988347

UK : http://www.amazon.co.uk/Ejb-3-Action-Debu-Panda/dp/1933988347

With the release of the book I’m relieved and looking forward to reviews by readers. We have a great draft review from JavaRanch and hope many good reviews will pour in!

Tuesday, March 13, 2007

EJB 3 In Action: Book Promotion

JavaRanch has arranged a promotional event for our book EJB 3 In Action (http://www.manning.com/panda/) . You can ask some questions about our book or EJB 3 technology in general in their EJB and Technologies forum and get a chance to win a copy of the book.


The book goes to press today. eBook will be available on Mar 15 and print copies will be available Mar 30. You can buy eBoook or print book from Manning web site.

You can also order copies from Amazon!

Tuesday, March 06, 2007

EclipseLink FAQ

Oracle proposed the EclipseLink Persistence framework based on its TopLink product. I forgot to link the FAQ for this. Here it is !

Oracle open sourced complete TopLink product as an Eclipse project

Oracle donates the complete TopLink product to Eclipse.

You may remember that Oracle had earlier contributed TopLink Essentials (a part of TopLink) to Sun’s Glassfish project that became the reference implementation for the EJB 3 JPA spec. However today's announcement is for proposing new Java persistence project based on TopLink product that includes support for ORM, Object-XML Mapping, JAXB, SDO, etc.

See the complete press release

Friday, March 02, 2007

Customizing JNDI name for Session beans

Every vendor provides its own way of registering Session bean interfaces into their global JNDI tree. If you care about portability then you should NOT depend upon the global JNDI name and use the ref-name by using ejb-ref or ejb-local-ref and lookup the EJB from environment naming context using java:comp/env/<ref-name>. However many have their own reasons not to use the standard convention and use the vendor specific JNDI name.

If you are such a soul and want to customize the global JNDI name for a session bean in OC4J you can package an orion-ejb-jar.xml and specify location attribute (for remote interface) and local-location (for local interface) as follows:

<session-deployment location="PlaceOrderBean" name="PlaceOrder"></SESSION-DEPLOYMENT>

Note that OC4J uses the ejb-name element in the ejb-jar.xml or name parameter in @Stateless or @Stateful annotations as the default JNDI name for the remote interface.

If you are using EJB 3 and annotation fanatic then you can use either @StatelessDeployment or @StatefulDeployment annotation to specify the JNDI names as follows:

@StatefulDeployment(location="PlaceOrder",
localLocation="PlaceOrderBeanLocal")

Even if I want you to marry to our platform and use the global JNDI name so that your migration becomes difficult but I will advise against using global JNDI names and recommend that you to use ejb-ref for portability reasons.