Top Description Methods
org.eclipse.persistence.dynamic

public Interface DynamicEntity

Known Direct Implementers
org.eclipse.persistence.internal.dynamic.DynamicEntityImpl
Imports
org.eclipse.persistence.exceptions.DynamicException

DynamicEntity is the public interface for dealing with dynamic persistent objects.

The purpose of dynamic persistent objects is to enable (simple) data access when only mapping information is available
and no concrete Java model is present (specifically, no .class files .)

Applications using DynamicEntity's can access the persistent state using property names which correspond
to the mapped attributes in the underlying EclipseLink descriptors. For properties mapped to containers (Collection,
Map, etc.), the property is retrieved then the resulting container can be manipulated.

    ...
    DynamicEntity de = ...; // retrieve from database
    Collection<String> myListOfGroups = de.<Collection<String>>get("myListOfGroups");
    if (!myListOfGroups.isEmpty()) {
       myListOfGroups.add("FabFour");
    }
To discover meta-data about a DynamicEntity's properties, see the DynamicHelper class
Author
dclarke, mnorman
Since
EclipseLink 1.2

Method Summary

Modifier and TypeMethod and Description
public <
generic type of the property (if not provided, assume Object). If the property cannot be cast to the specific type, a DynamicExceptionwill be thrown.
T
>
T

Returns:

persistent value or relationship container of the specified type
get
(String
the name of a mapped property If the property cannot be found, a DynamicException will be thrown.
propertyName
)

Return the persistence value for the given property as the specified type.

public boolean

Returns:

true if the property has been set
isSet
(String
the name of a mapped property If the property cannot be found, a DynamicException will be thrown.
propertyName
)

Discover if a property has a persistent value

public DynamicEntity

Returns:

the same DynamicEntity instance
set
(String
the name of a mapped property If the property cannot be found, a DynamicException will be thrown.
propertyName
,
Object
the specified object
value
)

Set the persistence value for the given property to the specified value

Method Detail

getback to summary
public <T> T get(String propertyName) throws DynamicException

Return the persistence value for the given property as the specified type. In the case of relationships, this call will populate lazy-loaded relationships

Parameters
<T>
generic type of the property (if not provided, assume Object). If the property cannot be cast to the specific type, a DynamicExceptionwill be thrown.
propertyName:String

the name of a mapped property If the property cannot be found, a DynamicException will be thrown.

Returns:T

persistent value or relationship container of the specified type

isSetback to summary
public boolean isSet(String propertyName) throws DynamicException

Discover if a property has a persistent value

Parameters
propertyName:String

the name of a mapped property If the property cannot be found, a DynamicException will be thrown.

Returns:boolean

true if the property has been set

setback to summary
public DynamicEntity set(String propertyName, Object value) throws DynamicException

Set the persistence value for the given property to the specified value

Parameters
propertyName:String

the name of a mapped property If the property cannot be found, a DynamicException will be thrown.

value:Object

the specified object

Returns:DynamicEntity

the same DynamicEntity instance