Wednesday, June 22, 2011

EclipseLink 2.3.0 (Indigo) Released

Since joining the family here at Eclipse a few years ago, one thing I can always count on is a hectic and exciting start to summer. This summer is no exception, and is kicked off with the release of EclipseLink 2.3.0 (Indigo).

Before I continue with brief descriptions of some of the new features of EclipseLink 2.3.0, I would like to thank everyone who was involved with this release. Whether your contribution to the project consisted of finding and entering bugs, contributing to the forums, or designing and implementing features, your contribution was important to the success of this project. Thank you, and I look forward to your contributions to our next major releases.

There are too many features and enhancement requests to touch on everything in this blog post, so I am going to limit it to what I believe are the highlights. For a complete 2.3.0 feature list, and to download and try out some of this stuff yourself, please click here.

Extend Entities
2.3.0 offers EclipseLink users the ability to extend their model (JPA entities or MOXy JAXB beans) so that a set of additional extended mappings can be used at runtime. These additional mappings offer more flexibility for developers that may not know all the mappings required for the application at design time.

Support Multiple Tenants
2.3.0 offers developers the ability to design and deploy applications where their persistent entities for multiple tenants are stored in a shared table. A column (or columns) in the table is designated as the discriminator for the tenant.

Externalize Mappings
Mappings for your model (JPA entities or MOXy JAXB beans) can now be stored externally to the running application. This allows mapping overrides and extended mappings (new in 2.3.0) to be easily and dynamically integrated into deployed applications.

Multiple Database
Developers can now store different entities in different databases, and even have relationships between them using Composite Persistence Units (PU). This feature gives developers the ability to build persistence units, each connecting to their own datasource, and compose them together under a parent PU. The parent PU is then used as if it is a standard persistence unit.

Click here for more information, including examples and docs, on the above features, and to download 2.3.0.

Peter

Friday, June 17, 2011

EclipseLink Indigo Preview: Shared Databases for Multiple Tenants

Challenged to take an existing application and re-use it for a new customer or group of users (tenant)? Instead of customizing the application, adding new hardware or re-configuring the database for each new tenant, you can now build EclipseLink JPA enabled applications hosting requests from multiple tenants with all their data co-located.

Starting with EclipseLink 2.3, part of the annual Eclipse Indigo release, you can now have multiple application tenants sharing a database schema. EclipseLink enables you to configure your database tables for shared storage by simply providing tenant discriminator column(s) and providing values for these discriminators within your application. This allows your tenants to share the same schema without being aware of one another.

Of course in some instances, you may wish to share some data across tenants. No problem! EclipseLink allows you to share and isolate as much or as little as your application requires.

The beauty and ease of creating such an environment lies simply in decorating those entities that need to be isolated per tenants with an @Multitenant specification. Shared entities need not be configured any further then required by the JPA specification.

For more information on how to take advantage of this new functionality, follow the link:

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Multitenant

Please note: The final release date for EclipseLink 2.3 is June 22, 2011 and the examples and documentation will evolve as the release date approaches. If you would like more detail, please check back after the release date or take advantage of our mailing lists and forums.

Friday, June 10, 2011

Extend your Persistence Unit on the fly

Imagine a system that keeps track of player statistics in a sports league. Personal information such as name, height, weight and basic statistics such as the number of games played is stored for all players.

A persistence unit is deployed with all the mappings described above.

The system admin of a basketball league wants to use the system and add mappings for points scored and fouls. As the system is running they tell EcliseLink about mappings for those fields and the next EntityManager they get uses them.

Starting with EclipseLink 2.3, you can do just that. To do that, all you have to do is:

- Build a traditional persistence unit
- Tweak your Entities so they can hold added mappings
- Build room for additional data into your database schema
- Define a repository to contain your additional mappings and tell EclipseLink about it

With those steps, any EntityManager created from your persistence unit will use your new mappings.

Additionally, you can refresh your EntityManagerFactory. Any EntityManager created after the refresh will use any new mappings added to the repository since the previous refresh.





The following link shows an example of how a system as described above could be configured. Please note: The final release date for EclipseLink 2.3 is June 22, 2011 and the examples and documentation will evolve as we get closer to that date. If you would like more detail, please check back after the release date or take advantage of our mailing lists and forums.

http://wiki.eclipse.org/EclipseLink/Examples/JPA/Extensibility

Friday, June 3, 2011

EclipseLink RefCardz Available

A new RefCardz is available from DZone on JPA development with EclipseLink:

http://refcardz.dzone.com/refcardz/eclipselink-jpa

Thanks to Gordon Yorke for his hard work putting this together during the busy months leading up to the EclipseLink 2.3 (Indigo) release.

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