Oracle Blog

Blog for edo

Thursday Dec 10, 2009

Today Sun announced the general availability of Java Platform, Enterprise Edition (Java EE) 6 and GlassFish v3. As many of you know, Java EE 5 made it significantly easier to develop web and enterprise applications. However, Java EE 6 pushes the usability envelope even further, adding ease of use improvements in many areas of the platform. For example, you can now use annotations to define web components such as servlets and servlet filters. In addition, Java EE application packaging requirements are much simpler. For example, you can add an enterprise bean directly to a web archive (WAR) file. You no longer need to package an enterprise bean in a Java archive (JAR) file and then put the JAR file in an enterprise archive (EAR) file.

Beyond those improvements, Java EE 6 adds many new features that make the platform more flexible and extensible. Java EE 6 introduces the concept of profiles, configurations of the platform that are designed for specific classes of applications. The first of these profiles, the Web Profile, is now available. It offers a subset of the Java EE platform designed for web application development.

On the extensibility front, Java EE 6 includes more extensibility points and more service provider interfaces than ever before. This allows you to plug in technologies — even frameworks — in your Java EE 6 implementations in a standard way. And with new features such as web fragments, Java EE 6 modularizes deployment descriptors, something that enables web frameworks to self-register, making it easy to incorporate and configure them in an application.

GlassFish v3 is a lightweight, flexible, and open-source application server that is the reference implementation for Java EE 6. But it's much more than that. It also offers a wide range of new productivity features, such as a modular runtime based on OSGi, that makes for extremely fast startup, efficient memory use, and runtime performance. GlassFish v3 also supports a deploy-on-save feature, such that when you update an application and save the changes in an enabled IDE such as NetBeans 6.8, the application is automatically redeployed. Many other enhancements, such as native support for scripting languages and frameworks like JRuby on Rails, make GlassFish v3 an ideal application server for web and enterprise applications.

CDI defines a set of services for the Java EE environment that makes applications much easier to develop. Perhaps most significantly, CDI unifies and simplifies the Enterprise JavaBeans (EJB) and JavaServer Faces (JSF) programming models. It allows enterprise beans to act as managed beans in a JSF application.

Until now there has not been a standard approach for annotation-based dependency injection. Dependency Injection For Java changes that by introducing a standard set of annotations that can be used for dependency injection.

If you're involved with creating user interfaces (UIs) for web applications, you're probably familiar with JavaServer Faces. It's a technology that provides a server-side component framework that is designed to simplify the development of UIs for Java EE applications. The latest release of the technology, JSR 314: JavaServer Faces 2.0, makes UI development for Java EE applications even easier through support for annotations and the addition of new features such as Facelets and composite components.

You can get a good idea of how these technologies simplify web application development by reading the Tech Tip Using CDI and Dependency Injection for Java in a JSF 2.0 Application, written by Roger Kitain, the JavaServer Faces co-specification lead. Roger presents a JSF 2.0 application and shows in the source code where CDI components and Dependency Injection for Java annotations play a role.

Tuesday Sep 29, 2009

One of the real success stories behind Java EE 5 is the Java Persistence API, know informally as JPA. The technology has been widely adopted and is recognized as the enterprise standard for Object/Relational (O/R) persistence.

However, one of the shortcomings of JPA 1.0 is that the only type of locking it supports is optimistic locking. Recall that locking is a technique for handling database transaction concurrency. When two or more database transactions concurrently access the same data, locking is used to ensure that only one transaction at a time can change the data.

There are generally two locking approaches: optimistic and pessimistic. Optimistic locking assumes that there will be infrequent conflicts between concurrent transactions, that is, they won't often try to read and change the same data at the same time. In optimistic locking, the objective is to give concurrent transactions a lot of freedom to process simultaneously, but to detect and prevent collisions. Two transactions can access the same data simultaneously. However, to prevent collisions, a check is made to detect any changes made to the data since the data was last read.

Pessimistic locking assumes that transactions will frequently collide. In pessimistic locking, a transaction that reads the data locks it. Another transaction cannot change the data until the first transaction commits the read.

The next release of JPA, JPA 2.0, which will be offered as part of Java EE 6, adds support for pessimistic locking. Using JPA 2.0, you can lock an entity either optimistically or pessimistically, depending on how often you think transactions will collide.

Tuesday Jul 07, 2009

Over the years, the Java virtual machine (JVM) has been host to a growing number of languages. Increasingly, JVM implementations of dynamic languages are becoming available, such as JRuby, an implementation of the Ruby programming language, Jython, an implementation of the Python programming language, and the Groovy scripting language.

However, developers of these dynamic languages have faced a troublesome obstacle. When developers write engines for dynamically typed languages that run in the JVM, they have to satisfy the requirements of the Java bytecode that the JVM executes. Until now, that bytecode has been designed exclusively for statically typed languages. This design has been especially painful for developers when generating bytecodes for method invocations.

Thursday Jul 31, 2008

With the addition of support for scripting languages in the Java platform, there has been a lot of interest in combining into web applications scripting languages such as Groovy, Java technologies such as the Java Persistence API (JPA), and databases such as MySQL. Read the tip
Combining Groovy, Grails, MySQL, and the Java Persistence API and learn how to create an online catalog application using the Groovy language, the Grails framework, the MySQL database, the Java Persistence API, and the GlassFish application server. You'll also learn about the latest NetBeans IDE offering, NetBeans IDE 6.5 Milestone 1 (or M1 for short), which offers many new features including support for Groovy and Grails.

Saturday Jul 12, 2008

Check out the transcript of the Ask the Experts session on Java SE 6 Update 10 that was held the week of July 7, 2008. Danny Coward, Java SE 6 Platform Lead; Ken Russell, Java Plug-In Lead; and Richard Bair, SwingLabs Lead, answered a wide variety questions, covering topics such as a Java Plugin for Mac OSX, Nimbus skins for components, the JKernel, and making a Java app download smaller.

Monday Jun 30, 2008

Java SE 6 Update 10, currently available as a beta release, introduces many new features and enhancements that dramatically improve the developer and user experience. Some of the significant improvements in Java SE 6 result in faster and easier deployment of Java applications and applets, better performance, and an improved look and feel. Got a question about Java SE 6 Update 10? Post it during this session on the Sun Developer Network Ask the Experts page and get answers from three key members of Sun's Java SE Platform team: Danny Coward, Java SE 6 Platform Lead; Ken Russell, Java Plug-In Lead; and Richard Bair, SwingLabs Lead.