Module org.eclipse.persistence.core
Class DynamicEntityImpl
java.lang.Object
org.eclipse.persistence.internal.dynamic.DynamicEntityImpl
- All Implemented Interfaces:
ChangeTracker
,DynamicEntity
,PersistenceEntity
,FetchGroupTracker
- Direct Known Subclasses:
XRDynamicEntity
public abstract class DynamicEntityImpl
extends Object
implements DynamicEntity, PersistenceEntity, ChangeTracker, FetchGroupTracker
This abstract class is used to represent an entity which typically is not
realized in Java code. In combination with the DynamicClassLoader ASM is used
to generate subclasses that will work within EclipseLink's framework. Since
no concrete fields or methods exist on this class the mappings used must be
customized to use a custom AttributeAccessor (
ValuesAccessor
).
Type/Property Meta-model: This dynamic entity approach also includes a
meta-model facade to simplify access to the types and property information so
that clients can more easily understand the model. Each
DynamicTypeImpl
wraps the underlying EclipseLink
relational-descriptor and the DynamicPropertiesManager
wraps each mapping.
The client application can use these types and properties to facilitate
generic access to the entity instances and are required for creating new
instances as well as for accessing the Java class needed for JPA and
EclipseLink native API calls.
- Since:
- EclipseLink 1.2
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected CacheKey
protected Map
<String, DynamicEntityImpl.PropertyWrapper> -
Constructor Summary
ModifierConstructorDescriptionprotected
Instantiates a new dynamic entity impl. -
Method Summary
Modifier and TypeMethodDescriptionReturn the fetch group being trackedPUBLIC: Return the PropertyChangeListener for the object.Return the session for the object.boolean
_persistence_isAttributeFetched
(String attribute) Return true if the attribute is in the fetch group being tracked.void
Reset all attributes of the tracked object to the un-fetched state with initial default values.void
_persistence_setCacheKey
(CacheKey cacheKey) void
Set a fetch group to be tracked.void
void
PUBLIC: Set the PropertyChangeListener for the object.void
_persistence_setSession
(Session session) Set true if the fetch group attributes should be refreshedvoid
_persistence_setShouldRefreshFetchGroup
(boolean shouldRefreshFetchGroup) Set true if the fetch group attributes should be refreshed.boolean
Return true if the fetch group attributes should be refreshed.abstract DynamicPropertiesManager
Fetch properties manager.<T> T
Return the persistence value for the given property as the specified type.Gets the properties map.getType()
Gets internal impl class ofDynamicType
.boolean
Discover if a property has a persistent valueprotected void
Post construct.Set the persistence value for the given property to the specified valueSets the.toString()
String representation of the dynamic entity using the entity type name and the primary key values - something like {Emp 10} or {Phone 234-5678 10}.
-
Field Details
-
propertiesMap
-
cacheKey
-
-
Constructor Details
-
DynamicEntityImpl
protected DynamicEntityImpl()Instantiates a new dynamic entity impl.
-
-
Method Details
-
fetchPropertiesManager
Fetch properties manager.- Returns:
- the dynamic properties manager
-
getPropertiesMap
Gets the properties map.- Returns:
- the properties map
-
postConstruct
protected void postConstruct()Post construct. -
getType
Gets internal impl class ofDynamicType
.- Returns:
- Dynamic type of this entity
- Throws:
DynamicException
- if type is null
-
get
Description copied from interface:DynamicEntity
Return the persistence value for the given property as the specified type. In the case of relationships, this call will populate lazy-loaded relationships- Specified by:
get
in interfaceDynamicEntity
- Type Parameters:
T
- generic type of the property (if not provided, assume Object). If the property cannot be cast to the specific type, aDynamicException
will be thrown.- Parameters:
propertyName
- the name of a mapped property If the property cannot be found, aDynamicException
will be thrown.- Returns:
- persistent value or relationship container of the specified type
- Throws:
DynamicException
-
isSet
Description copied from interface:DynamicEntity
Discover if a property has a persistent value- Specified by:
isSet
in interfaceDynamicEntity
- Parameters:
propertyName
- the name of a mapped property If the property cannot be found, aDynamicException
will be thrown.- Returns:
- true if the property has been set
- Throws:
DynamicException
-
set
Description copied from interface:DynamicEntity
Set the persistence value for the given property to the specified value- Specified by:
set
in interfaceDynamicEntity
- Parameters:
propertyName
- the name of a mapped property If the property cannot be found, aDynamicException
will be thrown.value
- the specified object- Returns:
- the same DynamicEntity instance
- Throws:
DynamicException
-
set
public DynamicEntity set(String propertyName, Object value, boolean firePropertyChange) throws DynamicException Sets the.- Parameters:
propertyName
- the property namevalue
- the valuefirePropertyChange
- the fire property change- Returns:
- the dynamic entity
- Throws:
DynamicException
- the dynamic exception
-
_persistence_getId
- Specified by:
_persistence_getId
in interfacePersistenceEntity
-
_persistence_setId
- Specified by:
_persistence_setId
in interfacePersistenceEntity
-
_persistence_getCacheKey
- Specified by:
_persistence_getCacheKey
in interfacePersistenceEntity
-
_persistence_setCacheKey
- Specified by:
_persistence_setCacheKey
in interfacePersistenceEntity
-
_persistence_getPropertyChangeListener
Description copied from interface:ChangeTracker
PUBLIC: Return the PropertyChangeListener for the object.- Specified by:
_persistence_getPropertyChangeListener
in interfaceChangeTracker
-
_persistence_setPropertyChangeListener
Description copied from interface:ChangeTracker
PUBLIC: Set the PropertyChangeListener for the object.- Specified by:
_persistence_setPropertyChangeListener
in interfaceChangeTracker
-
_persistence_getFetchGroup
Description copied from interface:FetchGroupTracker
Return the fetch group being tracked- Specified by:
_persistence_getFetchGroup
in interfaceFetchGroupTracker
-
_persistence_setFetchGroup
Description copied from interface:FetchGroupTracker
Set a fetch group to be tracked.- Specified by:
_persistence_setFetchGroup
in interfaceFetchGroupTracker
-
_persistence_setShouldRefreshFetchGroup
public void _persistence_setShouldRefreshFetchGroup(boolean shouldRefreshFetchGroup) Description copied from interface:FetchGroupTracker
Set true if the fetch group attributes should be refreshed.- Specified by:
_persistence_setShouldRefreshFetchGroup
in interfaceFetchGroupTracker
-
_persistence_shouldRefreshFetchGroup
public boolean _persistence_shouldRefreshFetchGroup()Description copied from interface:FetchGroupTracker
Return true if the fetch group attributes should be refreshed.- Specified by:
_persistence_shouldRefreshFetchGroup
in interfaceFetchGroupTracker
-
_persistence_isAttributeFetched
Return true if the attribute is in the fetch group being tracked.- Specified by:
_persistence_isAttributeFetched
in interfaceFetchGroupTracker
- Parameters:
attribute
- the attribute- Returns:
- true, if successful
-
_persistence_resetFetchGroup
public void _persistence_resetFetchGroup()Reset all attributes of the tracked object to the un-fetched state with initial default values.- Specified by:
_persistence_resetFetchGroup
in interfaceFetchGroupTracker
-
_persistence_getSession
Description copied from interface:FetchGroupTracker
Return the session for the object.- Specified by:
_persistence_getSession
in interfaceFetchGroupTracker
-
_persistence_setSession
Description copied from interface:FetchGroupTracker
Set true if the fetch group attributes should be refreshed- Specified by:
_persistence_setSession
in interfaceFetchGroupTracker
-
toString
String representation of the dynamic entity using the entity type name and the primary key values - something like {Emp 10} or {Phone 234-5678 10}.
-