Workshop on EJB 3.0 Persistence - Download Resources americas cup win 2682133k1

Workshop on EJB 3.0 Persistence – Download Resources

Yesterday we had a very enjoyable and I think interesting workshop on EJB 3.0 Persistence. After a very nice dinner on our terrace – it was lovely weather – we discussed the merits of the EJB 3.0 Persistence specification (JSR-220 – accepted on May 1st). After talking about the history of Object Relational Mapping in general and the rise and fall of EJB up to 2.1, as well as the unfortunate career of JDO, we cut to the chase. The EntityManager and its services, the Mapping Annotations and the various implementations, such as Toplink, Hibernate, Kodo and Glassfish.

For the demonstrations and the workshop, we used one of the latest promoted builds from the Glassfish Reference Implementation – to be precise: from the stand alone Persistence Library that was first release on April 20th. Note that instead of 80 Mb, we can now suffice with little over 2 Mb to get started with Glassfishh EJB 3.0 Persistence! Our tool of choice was JDeveloper 10.1.3, but there is nothing specific about the labs or the demo-sources. In fact, the last lab is on Dali, the Eclipse plugin for EJB 3.0 Persistence.

The presentation for this session can be downloaded here: ejb30PersistenceWorkshop9mei2006.ppt.

In a later post, I will go into some of the questions that were raised in the session – there were some very interesting points made.

 

Workshop Getting started with EJB 3.0 Persistence API

9th May 2006, AMIS – Nieuwegein

In this workshop, we will learn how to get started with the EJB 3.0 Persistence API. We will work with the GlassFish Reference Implementation (Build 48 – see https://glassfish.dev.java.net/downloads/persistence/JavaPersistence.html ) , with stand-alone J2SE applications – so outside the container – focusing on the core Persistence API concepts.

In the workshop, we will start with configuring our environment and creating our first running EJB 3.0 Persistence application – the equivalent of an HelloWorld. For this we need only a basic set of Mapping Annotations.

Next we will look at DML operations: how can we use the EntityManager to create, update and remove entities from the persistent store.

The following section discusses more complex Mappings in EJB 3.0 Persistence: mapping Foreign Keys, many to many relationships and intersection tables and dealing with Database Sequences to auto-generate primary key values as well as implementing a simple Optimistic Locking policy.

The last section of today’s workshop is focused on querying data through the EJB 3.0 Persistence API. We will see how we can use EJB QL to execute queries expressed in terms of our entities and attributes – instead of table and column names. Then we will also see how the Query interfaces allows us to perform Native Queries when we want to leverage special database functionality such as Oracle Analytical Functions or Scalar Subqueries. Luckily, we can still map the results of those queries to our Entities.

What we will not do in this workshop: use vendor specific implementations of EJB 3.0 Persistence API such as Toplink 10.1.3 or Hibernate 3.x. We will also not work inside EJB containers (or Servlet containers for that matter). That also means that we will not look into invoking Stored Procedures – not catered for in the EJB 3.0 Persistence specification but supported in vendor specific implementations – or into Caching solutions – also not part of the specification , however required in enterprise level conditions.

Download the workshop materials here: EJB30_Persistence_May2006.zip (5Mb).

One Response

  1. Lucas Jellema September 13, 2006