|
org.netbeans.modules.j2ee.persistenceapi/1 1.0.20 | |||||||||
PREV NEXT | FRAMES NO FRAMES |
See:
Description
Java Persistence API Support API | |
---|---|
org.netbeans.modules.j2ee.persistence.api | |
org.netbeans.modules.j2ee.persistence.spi | |
org.netbeans.modules.j2ee.persistence.spi.support |
This module provides the JavaPersistenceAPISupportAPI which allows the infrastructure supporting Java Persistence API (JPA) to retrieve informatiou about JPA features provided by projects. It mainly consists of SPI interfaces which must be implemented by projects and put in their default lookups.
First initial release of the Java Persistence API Support API.
The entry point to the Java Persistence API is the
persistence.xml
file, which contains persistence units.
Persistence units are logical groupings of entity classes and mapping
metadata which specifies the mapping of the entity classes to a database.
The support for Java Persistence API needs to locate the default location
for the persistence.xml
file in a project and to
trigger the creation of this location if it doesn't exist. This is
supported by the PersistenceLocation
class. It delegates
to the PersistenceLocationProvider
interface, which is
supposed to be implemented by projects and put in their lookups.
The entity classes defined by a persistence.xml
file can be
used by clients, e.g. a servlet or an EJB session bean. It must be possible
for such as client to find out if there is a persistence.xml
available and the entity classes defined by its persistence units.
For this the concept of a persistence scope was introduced. A
persistence scope is the grouping of a persistence.xml
file
and a classpath containing entity classes. A persistence scope is described
by the PersistenceScope
class. The
PersistenceScope.getPersistenceScope(FileObject)
method can be
used to retrieve the persistence scope for a given FileObject
.
This method delegates to the PersistenceScopeProvider
, which
must be implemented by projects and put in their lookups.
A PersistenceScope
instance is created by implementing the
PersistenceScopeImplementation
interface and passing it to the
PersistenceScopeFactory.createPersistenceScope()
method.
Sometimes it is necessary to retrieve a list of all persistence scopes
defined by a project and it must be possible to listen for changes to this
list. This is supported by the PersistenceScopes
class. The
PersistenceScopes.getPersistenceScopes(Project)
method can be
used to retrieve a PersistenceScopes
for a given project. This
method delegates to the PersistenceScopesProvider
, which mus
be implemented by projects and put in their lookups.
The PersistenceScopes.getPersistenceScopes()
method can be
used to retrieve an array of PersistenceScope
's. There are
also methods for adding and removing a PropertyChangeListener
for listening on the list of persistence scopes.
A PersistenceScopes
instance is created by implementing the
PersistenceScopesImplementation
interface and passing it to the
PersistenceScopesFactory.createPersistenceScopes()
method.
To help a project implement PersistenceScopesProvider
easily
the PersistenceScopesHelper
class is provided. It supports
managing a PersistenceScope
and listening to the respective
persistence.xml
file and sending property change events
accordingly.
The support for Java Persistence API needs to retrieve the entity classes
defined in a project. A project can serve as a class library containing
entity classes for other projects which does not contain a
persistence.xml
itself, thus it doesn't provide any
PersistenceScope
's. This is solved by the
PersistenceClassPathProvider
inteface, which returns a
classpath containing entity classes.
|
|
The sources for the module are in NetBeans CVS in j2ee/persistenceapi directory.
Only friend modules can declare a dependency on this module.
Read more about the implementation in the answers to architecture questions.
|
org.netbeans.modules.j2ee.persistenceapi/1 1.0.20 | |||||||||
PREV NEXT | FRAMES NO FRAMES |