In previous toplink versions (9.04 and older)private owned relationships
would tell a unitofwork to insert owned objects together with an owned
Apparently Eclipselink does not work this way in JPA on glassfish v2 - a
"private owned" one-to-one mapping from owner to owned does not cause the
EntityManager to persist a new owned object when em.persist(owner) is
With setting mapping.cascadeAll(true) programmatically at least a
unitofwork obtained via
EntityManager.delegate.activeSession.acquireUnitOfWork will insert the
owned object when the owner is registered and the uow is committed.
But the mapping workbench does not support the setting of cascade-type.
Do I have to use annotations, programmatical changes, ... or is there a
better way to use eclipselink with the mapping workbench for ownership
relations with JPA-SunAS9?
> In previous toplink versions (9.04 and older)private owned relationships
> would tell a unitofwork to insert owned objects together with an owned
typo in first sentence - should be
... insert owned objects together with an "owner" object.
You can use an amendment method from the Mapping Workbench to set the
mapping's cascade. You could also use a SessionCustomizer to iterate over
all the descriptors for the session and set cascade all for any private
In general the Mapping Workbench is meant for the native API, not for JPA.
For JPA you can use annotations, orm.xml, or JPA UI's such as Eclipse
well, I like the mapping workbench with its round-trip capabilies for both
object model and database. Actually I was quite happy that we could have
the MWB's project.xml and sessions.xml with JPA. A single amendment method
or SessionCustomizer would not stop me ;-)
But if it is not meant/recommended then we will not use the MWB for a new
project and rather use Eclipse Dali or similar.
Any plans to have the MWB support JPA?
It is actually the same development team from the Workbench who is
building Dali. The Workbench provides a great solution for mapping classes
based on their byte-codes but with JPA and JAXB providing mapping
capabilities using annotations it becomes very difficult to have the
workbench modify source without effectively building an IDE.
Our goal is to continue to enhance Dali to deliver all the standard JPA
mapping features you need while also providing EclipseLink specific
extensions to leverage advanced features. Dali does provide support for
generating a JPA entity model from the schema and will soon support the
eclipselink-orm.xml mapping file with our advanced features.
The Dali newsgroup is available here if you wish to give feedback directly
to the development team: