Monday, September 20, 2010

EclipseLink at Open World/Java One/Oracle Develop 2010

The EclipseLink project will be well represented this year at Java One and Open World. If you are here attending the shows then I recommend you attend some of our sessions or drop by and visit us at the exhibition booths.

ID#: S314492
Title: Java Persistence API (JPA) 2.0 with EclipseLink
Date: 20-SEP-10
Time: 16:00-17:00
Hilton San Francisco, Golden Gate 4/5

ID#: S317452
Title: Advanced Enterprise Persistence
Date: 22-SEP-10
Time: 10:00-11:00
Hotel Nikko, Nikko Ballroom II

S314491: Effective XML: Leveraging JAXB and SDO
Date: 22-SEP-10
Time: 13:00-14:00
Hilton San Francisco, Yosemite A

S313434: Java Persistence API Futures BOF
Date: 22-SEP-10
Time: 14:15-15:15
Hilton San Francisco, Yosemite A

ID#: S318574
Title: Scaling JPA Applications with Oracle TopLink Grid and Oracle Coherence
Date: 22-SEP-10
Time: 16:45-17:45
Hilton San Francisco, Imperial Ballroom B

We also will be staffing exhibition booths on Oracle TopLink focusing on EclipseLink at the Oracle Fusion Middleware DEMOgrounds as well as helping staff the Oracle/Eclipse booth at the Java One exhibition hall and some time at the Eclipse Foundation booth.

We hope to meet as many EclipseLink users as possible and exchange ideas.

Doug

Thursday, August 5, 2010

Using partial EclipseLink JPA entities with JAXB

I spent much of the final months of the EclipseLink 2.1 (Helios) development championing the enhancements of our existing FetchGroup support to address additional uses cases around working with partial entities. The new functionality is referred to as AttributeGroup with support for FETCH (what columns get retrieved from the database), LOAD (what relationships are populated), COPY (what attributes and relationships and populated in detached copy), and MERGE (what attributes are merged from a detached partial entity). This additional support greatly simplifies application development where detached entities are used as well as providing additional performance tuning options and flexibility for other scenarios.

The purpose of this blog post is to help a user we were assisting on Twitter who wanted to use JAXB to marshal JPA entities into XML but only wanted a portion of the entities to be used. By default JAXB will traverse all available relationships including lazy ones that have not been loaded to build a complete XML document for the provided entities.

Here is a simple example reading a Customer with an Address (1:1) and PhoneNumber(s) (1:M) from a database and marshalling it into XML using EclipseLink JPA with EclipseLink MOXy.

Setup code for JPA and JAXB:
// JPA
EntityManagerFactory emf =
Persistence.createEntityManagerFactory("CustomerService");
EntityManager em = emf.createEntityManager();

// JAXB
JAXBContext jaxbContext = JAXBContext.newInstance(Customer.class);
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT,
true);
Example: Find & Marshall Customer
Customer customer = em.find(Customer.class, 1);
marshaller.marshal(customer, System.out);
When executed this generates the following XML and causes the customer's address and phone numbers to be loaded from the database.
Now, if we wanted to generate a partial XML document including only the Customer's basic attributes and its address's attributes we could use a copy group to create a partial copy and marshal it:
Customer customer = em.find(Customer.class, (long) 1);

CopyGroup cg = new CopyGroup();
cg.addAttribute("id");
cg.addAttribute("firstName");
cg.addAttribute("lastName");
cg.addAttribute("address.id");
cg.addAttribute("address.city");
cg.addAttribute("address.street");

JpaEntityManger nativeEM = em.unwrap(JpaEntityManager.class);
Customer custCopy = (Customer) nativeEM .copy(customer, cg);

marshaller.marshal(custCopy , System.out);
Now the generated XML appears as:

There are other combined uses of AttributeGroup that can be used to control what is fetched and loaded as well but this copy example should illustrate some of the options available and how EclipseLink JPA and MOXy components can be easily used together.

Doug

Additional MOXy examples available here.

Wednesday, June 23, 2010

EclipseLink 2.1.0 Helios Release Now Available

Hi all,

It is with great pleasure that I would like to announce the release of EclipseLink 2.1.0 (Helios). This release of brings a number of exciting features many of which were voted on, and chosen by the community.

Some of the JPA features included in this release are
- improved JPQL enhancements, and extensions including 'TREAT...AS' and 'FUNC'.
- Fetch, Load, Copy & Merge of partial entities using 'AttributeGroup'
- extentions to 'eclipselink-orm.xml'
- Dynamic Persistence: JPA without requiring Java classes.
- New Platforms: SAPNetWeaver Server Platform and Symfoware Database Platform
...and more...

Some of the MOXy features included in this release are
- JAXB 2.2.0 certified
- JAXB without annotations using externalized mappings in XML
- 'Dynamic Persistence': XML Binding without Java classes.
...and more...

Some of the SDO features included in this release are
- Support for EclipseLink SDO usage with 'WebSphere' and 'JBoss'
... and more...

Some of the DBWS features included in this release are
- Support DBWSBuilder-generated JAX-WS Provider on JRockit
- Support for Eclipse WTP Dynamic Web Project structure

2.1.0 also includes bug fixes that focus on performance, scalability, and stability. There were well over 300 bugs and enhancement requests closed for this release.

For a full list of features, and download instructions please see http://wiki.eclipse.org/EclipseLink/Release/2.1.0 .

We would like to thank everyone involved in the development of this release.

Peter Krogh and Douglas Clarke

Monday, May 31, 2010

EclipseLink Summit 2010 Wrap Up


Last week we held our first EclipseLink Summit here in Ottawa with attendees from Canada, Germany, India, and the US. The principal goal of the summit was the exchange of technical information and ideas. We believe the event was a tremendous success!

We spent 2 days with committers leading technical sessions discussing areas from high level components and architecture to the detailed workings of EclipseLink's querying, caching, transactions, management, diagnostics, metadata processing, JPA 2.0 metamodel, and several other subsystems.

We would like to extend a big thank you to all of the committers who lead those sessions. The preparation time invested was obvious and the quality was amazing. We know it was tough to squeeze this additional work into your hectic pre-Helios schedules. The feedback from all attendees was excellent.

On the 3rd day of the Summit we focused more on the project itself. Starting with a talk from Jeff McAffer (EclipseSource) on OSGi and Eclipse RT technologies. We then discussed EclipseLink and OSGi, documentation, development process, build, testing and our road map planning.

While not all of these sessions allowed us to come to concrete conclusions the discussions were great and will hopefully carry on in our weekly committer meetings where we continue to improve our processes and refine our direction.

For those interested a more detailed summary of our Thursday sessions will be published to the eclipselink-dev@eclipse.org mailing list and topics requiring further discussion will be added to the weekly meeting agenda.

Thanks again to all the presenters and attendees. We are all looking forward to future EclipseLInk Summits where we can gather committers, contributors, and and users to share ideas and grow our community.

Your Summit Program Committee

Doug Clarke, Peter Krogh, and Shaun Smith

Friday, April 9, 2010

EclipseLink Summit 2010

In an effort to increase the community of committers and contributors with in-depth knowledge of EclipseLink we have decided to host a 3-day Summit. The goal of this Summit will be to exchange detailed technical information and discuss future direction for the project and its persistence services.

All interested parties are welcome to participate.

More info on Summit is available here.

Doug