Java Persistence API specification requires that for portability reasons, persistence.xml file should contain the list of managed persistence classes. In this article, I shall show you how a simple program can be written using JAXB and APT to automatically generate persistence class list and update persistence.xml. An implementation of Java Persistence API is available in open source project called glassfish.
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.
Lot of developers still believe that when they use Java Persistence API (confusingly part of EJB 3 JSR), they need to bundle entity beans in a .par file. They would be relieved to know that, its not true any more. Sun's next version of application server which is being develped in open source project called glassfish does not require it's users to use any such extensions like .ejb3 or .par. Let's see why?
javax.persistence.TransactionRequiredException is a common exception that a web appliction developer gets while using the Java Persistence API (EJB 3.0) in Java EE 5 platform which is being reference implemented in prject glassfish. Let's try to find out what is the cause of this exception and how to fix it. We also compare this behavior with an EJB trying to do similar work.
Example of a very simple web application using Java Persistence API in Java EE environment is shown here. I will also discuss how how to package such an application in a portable way. We will do all these without using any kind of IDE so that we don't miss the details that often happen while using a super smart IDE. Although the example uses Java EE 5 RI (i.e. project glassfish) to build and run, it does not use any proprietary APIs.
This week I found 2 new and very different tech tips using technologies in GlassFish. One describes how to use AJAX and servlets for an autocomplete application and one is on converting POJO to a persistence entity. Both include sample code and instructions to run on GlassFish.
Before we dive into the frameworks, I want to drop back to basics to give some context behind why the frameworks exist and what benefits they provide. For this reason, let's look at a naive model 1 implementation of the sample application. If you're already familiar with the whole model 1 vs. model 2 thing, you might want to skip reading this particular entry.
Introducing new project lead on GlassFish, Jerome Dochez.
Many of the GlassFish documentation books are now available for review for the upcoming beta release.
There are two new tutorials available including one that builds an application using Java EE 5 Persistence.
GlassFish button 3 is the winner!
Jim, Carla and Amy will host a (first) Ask-the-Experts session at java.sun.com next week.
An "Ask the Experts" session will be running the week of Nov 14 to Nov 18 and it's a great way for you to submit questions about GlassFish to the team.
Before we kick off our look at webapp frameworks, let's establish the domain model we're working with.
We're looking for feedback from the community about the look and feel for the next GlassFish botton.
LA JUG meeting on GlassFish
So, to compare webapp frameworks we need an example web application.
"Imho this is a complete waste of time and it will be another biased comparison without any real use whatshowever." So, why am I doing this?
Struts, WebWork, Stripes, Spring MVC, Wicket, Tapestry, JSF, etc, or even rolling your own. With so many J2EE web application frameworks to choose from, how do you decide which one to use?
We're very excited to announce that developers from both Oracle and Sun contribute code to the persistence module in GlassFish.