YOUR FEEDBACK
IBM Buys Its Way Out of Antitrust Trouble
Plato wrote: L.L.Bean was never actually a customer of PSI. At most, they we...
SOA World Conference
Virtualization Conference
$50 Savings Expire June 24, 2008... – Register Today!


2007 West
GOLD SPONSORS:
Active Endpoints
Your SOA Needs BPEL for Orchestration
BEA
Virtualized SOA: Adaptive Infrastructure for Demanding Applications
Nexaweb
Overcoming Bandwidth Challenges with Nexaweb
TIBCO
What is Service Virtualization?
SILVER SPONSORS:
WSO2
Using Web Services Technologies and FOSS Solutions
Click For 2007 East
Event Webcasts

2008 East
PLATINUM SPONSORS:
Appcelerator
Think Fast: Accelerate AJAX Development with Appcelerator
GOLD SPONSORS:
DreamFace Interactive
The Ultimate Framework for Creating Personalized Web 2.0 Mashups
ICEsoft
AJAX and Social Computing for the Enterprise
Kaazing
Enterprise Comet: Real–Time, Real–Time, or Real–Time Web 2.0?
Nexaweb
Now Playing: Desktop Apps in the Browser!
Sun
jMaki as an AJAX Mashup Framework
POWER PANELS:
The Business Value
of RIAs
What Lies Beyond AJAX?
KEYNOTES:
Douglas Crockford
Can We Fix the Web?
Anthony Franco
2008: The Year of the RIA
Click For 2007 Event Webcasts
SYS-CON.TV
TOP LINKS YOU MUST CLICK ON


Hello Dali!
An introduction to the Eclipse Dali Java Persistence API tools project

Digg This!

Page 2 of 2   « previous page

Persistence Properties
The Persistence Outline gives you a brief summary of your mappings and lets you navigate between them, but doesn't offer any help in editing your mappings. That's the function of the second view contributed by Dali: the Persistence Properties view. In Figure 3, we saw how Dali validated mappings and put error markers in the Java editor and errors into the problems view. But as the saying goes, acknowledging you have a problem is just the first step. The Persistence Properties provides tools for understanding and resolving mapping problems.

The Persistence Properties view performs a couple of very useful functions. It shows how a mapping is configured and, perhaps even more importantly, it shows the defaults that will be applied by a JPA runtime when the Entity is deployed.

For example, in Figure 5 the column mapping for the number attribute is defaulting to True for insertable and True for updatable. Defaulted values are clearly visible through the use of the word "Default." Notice that the column name isn't marked as a default value because the developer has explicitly specified it in an annotation.

But let's return to the problem Dali identified with the number attribute - there's no such column as NUM in the Phone table. A valid column name has to be selected, and the Persistence Properties view can help. It offers valid options for all mapping settings including settings that require access to the data model.

In Figure 6 the column name dropdown contains all the Phone table columns. It also displays what the default column name would be if nothing were specified. Since the default is correct, the default may as well be used. With the entire mapping using default values Dali removes the mapping annotation from the Java source to keep it uncluttered by unnecessary annotations.

Figure 7 and Figure 8 show that with no column specified, in fact no mapping specified at all, the defaults validate against the data model and there are no problems.

Top Down and Bottom Up
We've seen how Dali can help with the "meet-in-the-middle" approach of mapping an object model to an existing database but two other approaches are supported. Using Dali, it's possible to start with a set of Java classes annotated as Entities and generate the database tables they map to. Generation of Entities from tables is also supported. The algorithm Dali uses for both Entity and table generation is defined by the JPA default mapping rules with a few extra heuristics to deal with differences in Java/database naming styles like underscores versus camel case. Dali's support for generation offers a quick way to bootstrap a new JPA application. You can generate Entities or tables to get a starter configuration and then refactor either knowing that Dali will flag any breakage in your mappings with problem markers.

Deployment
Deploying a JPA application is straightforward whether you're using Java SE or EE. Dali doesn't offer any specific packaging and deployment support beyond some assistance with maintaining the persistence.xml file (more on this below), however, deploying JPA Entities is just like deploying POJO applications. You can jar them up using the standard Eclipse support for exporting jars or include them in an Enterprise Archive (EAR) as a utility jar using the Web Tools Platform (WTP).

Persistence.xml
The one XML configuration file required in the JPA specification is the persistence.xml file. This file defines important runtime settings including database connection information and transaction type. When you add persistence support to a Java project, Dali creates a basic persistence.xml file and places in the src\META-INF folder. Typically you'll hand-edit this XML file to reflect your deployment configuration. (see Figure 9)

As mentioned, JPA applications can be deployed to both Java SE and EE environments. However, when running outside an EJB 3.0 container, JPA requires an additional piece of information in the persistence.xml: a list of all the persistent Entities. In the 0.5 release Dali provides support for keeping the persistence.xml in sync with your defined Entities. (see Figure 10)

Right-clicking on the persistence.xml file in the Package Explorer and selecting Java Persistence>Synchronize Classes will update its list of classes (Figure 11).

Future Directions
The focus of the Dali 0.5 release was annotation-based mapping and support for the core JPA mapping types. Dali 1.0 will offer editing and validation support for both annotation and XML-based mapping as well as the use of XML mappings to override annotations as defined in the JPA specification.

Smoother integration of the Dali tools with WTP is also a high priority for 1.0. The Dali project is now incubating inside WTP as one of the new Java EE 5 technologies that will be incorporated into WTP 2.0.

In 1.0, Dali will also leverage the enhanced database support provided by the Data Tools Project (DTP). The combination of WTP with Dali and the DTP will provide a comprehensive toolset for the development of Java applications that rely on relational data.

Getting Started
The best place to begin with Dali is to visit the project home page, check out the online demos, download the plug-ins, and go through the tutorial. The Dali newsgroup is monitored by the development team and is a great place to ask a question or get help.

And finally, like every Open Source Eclipse project, contributors are welcome. Contributors meet on the dali-dev@eclipse.org mailing list to discuss technical issues and make decisions.

Resources

  • Dali home page with links to downloads, documentation, project roadmap, and tutorials:
    www.eclipse.org/dali.
  • TopLink Essentials JPA Reference Implementation:
    http://otn.oracle.com/jpa.
  • JSR 220: Enterprise JavaBeans 3.0 specification:
    www.jcp.org/en/jsr/detail?id=220.

  • Page 2 of 2   « previous page

    About Shaun Smith
    Shaun Smith is co-lead of the Dali JPA Tools project and a principal product manager at Oracle for TopLink, the basis for the open source TopLink Essentials JPA reference implementation.

    LATEST ECLIPSE STORIES . . .
    Adobe's Kevin Lynch and Microsoft's Scott Guthrie to Keynote AJAX World RIA Conference & Expo
    Two of the biggest launches in Rich Internet Application history took place in 2007/2008 when Adobe launched AIR 1.0 in February '08 and Microsoft launched Silverlight (September '07). At the 6th International AJAXWorld RIA Conference & Expo in October SYS-CON Events is delighted to be
    Instantiations Rolls Out Product Updates in Conjunction with Eclipse 3.4 and Ganymede
    Instantiations announced that its entire Eclipse-based product line has been updated to coincide with the annual Eclipse open source release, Ganymede. Included with the roll-out are additions in the area of security to its CodePro AnalytiX comprehensive code quality product, bringing
    Quest Software's JProbe Now Available as Eclipse Plug-In
    Quest Software announced the latest release of its Java profiler, JProbe 8.0, which is now offered as a plug-in to the Eclipse Java Integrated Development Environment (IDE). The release of this capability aligns with the increased adoption of the open source development. Launching JPro
    Migrate to Eclipse 3.4 Ganymede, Manage Configurations with Pulse
    Genuitec announced the general availability of Pulse 2.2, a way to obtain, manage and configure Eclipse Ganymede and plugins. Genuitec is pleased to offer this product to Pulse users on the day of the Ganymede release. As of today, Pulse 2.2 will support full Ganymede tool stacks.
    Protecode Announces Governance and Intellectual Property Management Software
    Protecode announced the general availability of its software development tool for governance and Intellectual Property (IP) management. The latest release enables commercial software developers and open source creators to accelerate managed adoption of open source code in a simple, pai
    AccuRev and Rally Software Partner to Scale Agile Software Development Best Practices
    AccuRev and Rally announced a technology partnership that will integrate AccuRev software change and configuration management (SCCM) with Rally's Agile lifecycle management solutions. The combined solution will provide a platform to manage multiple Agile processes and ongoing customer
    SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
    SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
    Click to Add our RSS Feeds to the Service of Your Choice:
    Google Reader or Homepage Add to My Yahoo! Subscribe with Bloglines Subscribe in NewsGator Online
    myFeedster Add to My AOL Subscribe in Rojo Add 'Hugg' to Newsburst from CNET News.com Kinja Digest View Additional SYS-CON Feeds
    Publish Your Article! Please send it to editorial(at)sys-con.com!

    Advertise on this site! Contact advertising(at)sys-con.com! 201 802-3021

    SYS-CON FEATURED WHITEPAPERS

    ADS BY GOOGLE