Skip to main content

Interview with GlassFish persistence developers

Posted by carlavmott on December 7, 2005 at 5:01 PM PST

Last week I had the opportunity to talk with Tom Ware and Gordon Yorke who are working on the persistence module in project GlassFish. Both Tom and Gordon are from Oracle's Ottawa, Canada office and have extensive knowledge of the TopLink codebase. I got a chance to ask them some questions about persistence in GlassFish. Here's what they had to say.

Q. Who is working on EJB 3.0 persistence?

A. As an open source project, anyone can contribute, however the current workload is primarily being done by groups at Oracle and at Sun. People who wish to find out what is going on can simply join the glassfish project and subscribe to the persistence mailing list:

Q. How has Oracle contributed to the EJB 3.0 persistence RI?

A. Oracle has contributed TopLink Essentials to the GlassFish Project. TopLink Essentials is derived from our Oracle TopLink enterprise product. We want to provide a commercial quality RI and by leveraging Oracle TopLink it brings an advanced and proven object persistence implementation to the RI.

Q. What version of TopLink are users getting from the GlassFish project?

A. The GlassFish contribution is based on the most recent 10.1.3 version of Oracle TopLink.

Q. How much of the EJB 3.0 specification has been implemented in GlassFish?

A. The majority of functionality required by EJB 3.0 persistence is implemented. Since we’ve been able to leverage the existing Oracle TopLink product, the majority of the functionality required by EJB 3.0 persistence is already available in the TopLink Essentials RI. At this point in the development nearly all spec-defined features are exposed, with many being quite close to complete. Since the specification is not in its final draft we still expect to add new features as they are finalized. To ensure functional completeness, we have been working closely with the SUN TCK team. Check the persistence web page for updates on the implementation.

Q. Can you give a high level overview of EJB 3.0 persistence?

A. Usage of EJB 3.0 distils down to:

1. You use Java 5.0 annotations and/or xml descriptors to provide the
mapping details to map you business objects to your database
schema. These mapped objects will now act as a façade to the

2. The EntityManager API is used to control the life cycle of the
data objects. It controls when objects are persisted, removed and
modified in the database.

3. Data can be loaded into instances of mapped entities using the
EntityManager’s find method, or through queries defined in the
EJBQL query language, and executed through the Query interface.

Q. Are there examples on how to use EJB 3.0 Persistence within Java EE 5?

A. The GlassFish docs are still evolving however, currently there are a few examples that you may find useful to get started. See Sahoo's blog
and also there is an example on the persistence website here. We have plans to provide more detailed examples in the coming weeks.

Q. What about persistence outside of an EJB container?

A. One of the big improvements in the EJB 3.0 specification over previous EJB specifications is that now the same business objects can be deployed both in an EJB Container and outside of one.

Among other things, this simplifies testing. Tests can be run without ever starting your application server. This makes tasks such as debugging much more simple.

Q. Is the functionality to deploy to SE available now?

A. Yes, this is something we’ve been able to provide in the RI quite quickly since we first published our implementation of this functionality with the TopLink EJB 3.0 preview release last spring and have continually updated it as the specification evolved. Not only is this functionality available now, but we make use of it extensively when we test TopLink features. It is quite convenient.

Q. How do I deploy a Java SE application which uses persistence?

A. The GlassFish persistence website has instuctions on how to do this now. There is some work involved but for the adverturous developer it's not too bad. See the following example .

Q. How has the exercise of implementing this allowed you to provide feedback to the spec and improve it?

A. Throughout the spec process we have been lucky to have a close working relationship with Mike Keith the Specification co-lead. All along we have been able to provide Mike with feedback on the practicality of some of the spec proposals based on our experience working with users of ORM tools. As well we find that as we implement things, we are in a position to provide feedback about where the specification needs more detail.

Q. How will this specification benefit users?

A. I think the standardization of API's and functionality will help clear the confusion surrounding persistence in general. Users will now have a standard way of implementing their applications to leverage the power and convenience that a persistence provider provides.

Thanks Tom and Gordon for your time. I look forward to seeing more detailed articles descibing design features in the persistence module and also how to use this functionality both within the Java EE and the Java SE platforms.

Related Topics >>