EclipseLink 2.4.2, build 'v20130514-5956486' API Reference

org.eclipse.persistence.dynamic
Class DynamicHelper

java.lang.Object
  extended by org.eclipse.persistence.dynamic.DynamicHelper
Direct Known Subclasses:
JPADynamicHelper

public class DynamicHelper
extends java.lang.Object

A DynamicHelper provides some utility methods to simplify application development with dynamic types. Since the application does not have static references to the dynamic types it must use entity names. This helper provides simplified access to methods that would typically require the static classes.

Author:
dclarke, mnorman
Since:
EclipseLink 1.2

Nested Class Summary
static class DynamicHelper.SessionCustomizer
          A SessionCustomizer which configures all descriptors as dynamic entity types.
 
Field Summary
protected  java.util.Map<java.lang.String,ClassDescriptor> fqClassnameToDescriptor
           
protected  DatabaseSession session
           
 
Constructor Summary
DynamicHelper(DatabaseSession session)
           
 
Method Summary
 void addTypes(boolean createMissingTables, boolean generateFKConstraints, DynamicType... types)
          Add one or more EntityType instances to a session and optionally generate needed tables with or without FK constraints.
 DynamicClassLoader getDynamicClassLoader()
           
 DatabaseSession getSession()
           
static DynamicType getType(ClassDescriptor descriptor)
           
static DynamicType getType(DynamicEntity entity)
          Provide access to the entity's type.
 DynamicType getType(java.lang.String typeName)
          Lookup the dynamic type for an alias.
 DynamicEntity newDynamicEntity(java.lang.String typeName)
           
 ReadAllQuery newReadAllQuery(java.lang.String typeName)
          Helper method to simplify creating a native ReadAllQuery using the entity type name (descriptor alias)
 ReadObjectQuery newReadObjectQuery(java.lang.String typeName)
          Helper method to simplify creating a native ReadObjectQuery using the entity type name (descriptor alias)
 ReportQuery newReportQuery(java.lang.String typeName, ExpressionBuilder builder)
          Helper method to simplify creating a native ReportQuery using the entity type name (descriptor alias)
 void removeType(java.lang.String typeName)
          Remove a dynamic type from the system.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

session

protected DatabaseSession session

fqClassnameToDescriptor

protected java.util.Map<java.lang.String,ClassDescriptor> fqClassnameToDescriptor
Constructor Detail

DynamicHelper

public DynamicHelper(DatabaseSession session)
Method Detail

getSession

public DatabaseSession getSession()

getType

public DynamicType getType(java.lang.String typeName)
Lookup the dynamic type for an alias. This is required to get the type for factory creation but can also be used to provide the application with access to the meta model (type and properties) allowing for dynamic use as well as optimized data value retrieval from an entity.


getType

public static DynamicType getType(ClassDescriptor descriptor)

getType

public static DynamicType getType(DynamicEntity entity)
                           throws java.lang.ClassCastException
Provide access to the entity's type.

Parameters:
entity -
Returns:
Throws:
java.lang.ClassCastException - if entity is not an instance of DynamicEntityImpl

removeType

public void removeType(java.lang.String typeName)
Remove a dynamic type from the system. This implementation assumes that the dynamic type has no relationships to it and that it is not involved in an inheritance relationship. If there are concurrent processes using this type when it is removed some exceptions may occur.

Parameters:
session -
typeName -

newDynamicEntity

public DynamicEntity newDynamicEntity(java.lang.String typeName)

newReadAllQuery

public ReadAllQuery newReadAllQuery(java.lang.String typeName)
Helper method to simplify creating a native ReadAllQuery using the entity type name (descriptor alias)


newReadObjectQuery

public ReadObjectQuery newReadObjectQuery(java.lang.String typeName)
Helper method to simplify creating a native ReadObjectQuery using the entity type name (descriptor alias)


newReportQuery

public ReportQuery newReportQuery(java.lang.String typeName,
                                  ExpressionBuilder builder)
Helper method to simplify creating a native ReportQuery using the entity type name (descriptor alias)


getDynamicClassLoader

public DynamicClassLoader getDynamicClassLoader()

addTypes

public void addTypes(boolean createMissingTables,
                     boolean generateFKConstraints,
                     DynamicType... types)
Add one or more EntityType instances to a session and optionally generate needed tables with or without FK constraints.

Parameters:
session -
createMissingTables -
generateFKConstraints -
types -

EclipseLink 2.4.2, build 'v20130514-5956486' API Reference