|
EclipseLink 1.2.0, build 'v20091016-r5565' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.persistence.dynamic.DynamicTypeBuilder
public class DynamicTypeBuilder
The EntityTypeBuilder is a factory class for creating and extending dynamic entity types. After being constructed in either usage the application can then use the provided API to customize mapping information of the type.
Field Summary | |
---|---|
protected org.eclipse.persistence.internal.dynamic.DynamicTypeImpl |
entityType
The type being configured for dynamic use or being created/extended |
Constructor Summary | |
---|---|
DynamicTypeBuilder(java.lang.Class<?> dynamicClass,
DynamicType parentType,
java.lang.String... tableNames)
Create an EntityType for a new dynamic type. |
|
DynamicTypeBuilder(DynamicClassLoader dcl,
ClassDescriptor descriptor,
DynamicType parentType)
Create an EntityTypeBuilder for an existing descriptor. |
Method Summary | |
---|---|
AggregateObjectMapping |
addAggregateObjectMapping(java.lang.String name,
DynamicType refType,
boolean allowsNull)
TODO |
DirectCollectionMapping |
addDirectCollectionMapping(java.lang.String name,
java.lang.String targetTable,
java.lang.String valueColumn,
java.lang.Class<?> valueType,
java.lang.String... fkFieldNames)
TODO |
DirectToFieldMapping |
addDirectMapping(java.lang.String name,
java.lang.Class<?> javaType,
java.lang.String fieldName)
Allows DirectToFieldMapping (@Basic) mapping to be added to a
dynamic type through API. |
protected void |
addDynamicClasses(DynamicClassLoader dcl,
java.lang.String className,
DynamicType parentType)
Register a DynamicClassWriter with the provided
DynamicClassLoader so that a dynamic class can be generated when
needed. |
void |
addManyToManyMapping(java.lang.String name,
DynamicType refType,
java.lang.String relationshipTableName)
TODO |
protected DatabaseMapping |
addMapping(DatabaseMapping mapping)
Add the mapping to the types' descriptor. |
OneToManyMapping |
addOneToManyMapping(java.lang.String name,
DynamicType refType,
java.lang.String... fkFieldNames)
TODO |
OneToOneMapping |
addOneToOneMapping(java.lang.String name,
DynamicType refType,
java.lang.String... fkFieldNames)
Allows OneToOneMapping (@OneToOne and @ManyToOne) mappings to be
added to a dynamic type through API. |
protected void |
configure(ClassDescriptor descriptor,
java.lang.String... tableNames)
Initialize a new or existing descriptor configuring the necessary policies as well as |
void |
configureSequencing(Sequence sequence,
java.lang.String numberName,
java.lang.String numberFieldName)
|
void |
configureSequencing(java.lang.String numberName,
java.lang.String numberFieldName)
|
DynamicType |
getType()
|
static Project |
loadDynamicProject(java.io.InputStream resourceStream,
DatabaseLogin login,
DynamicClassLoader dynamicClassLoader)
Load a dynamic project from deployment XML creating dynamic types for all descriptors where the provided class name does not exist. |
static Project |
loadDynamicProject(java.lang.String resourcePath,
DatabaseLogin login,
DynamicClassLoader dynamicClassLoader)
Load a dynamic project from deployment XML creating dynamic types for all descriptors where the provided class name does not exist. |
void |
setPrimaryKeyFields(java.lang.String... pkFieldNames)
Set the PK field names on the underlying descriptor ensuring no duplicate names are added. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected org.eclipse.persistence.internal.dynamic.DynamicTypeImpl entityType
Constructor Detail |
---|
public DynamicTypeBuilder(java.lang.Class<?> dynamicClass, DynamicType parentType, java.lang.String... tableNames)
Creating new type Example:
DynamicHelper helper = new DynamicHelper(session);
DynamicClassLoader dcl = helper.getDynamicClassLoader();
Class> javaType = dcl.creatDynamicClass("model.Simple");
DynamicTypeBuilder typeBuilder = new JPADynamicTypeBuilder(javaType, null, "SIMPLE_TYPE");
typeBuilder.setPrimaryKeyFields("SID");
typeBuilder.addDirectMapping("id", int.class, "SID");
typeBuilder.addDirectMapping("value1", String.class, "VAL_1");
typeBuilder.addDirectMapping("value2", boolean.class, "VAL_2");
typeBuilder.addDirectMapping("value3", Calendar.class, "VAL_3");
typeBuilder.addDirectMapping("value4", Character.class, "VAL_4");
helper.addTypes(true, true, typeBuilder.getType());
dynamicClass
- parentType
- tableNames
- public DynamicTypeBuilder(DynamicClassLoader dcl, ClassDescriptor descriptor, DynamicType parentType)
dcl
- descriptor
- parentType
- provided since the InheritancePolicy on the descriptor may not
have its parent descriptor initialized.Method Detail |
---|
protected void addDynamicClasses(DynamicClassLoader dcl, java.lang.String className, DynamicType parentType)
DynamicClassWriter
with the provided
DynamicClassLoader
so that a dynamic class can be generated when
needed.
protected void configure(ClassDescriptor descriptor, java.lang.String... tableNames)
public DynamicType getType()
public void setPrimaryKeyFields(java.lang.String... pkFieldNames)
pkFieldNames
- qualified or unqualified field namespublic DirectToFieldMapping addDirectMapping(java.lang.String name, java.lang.Class<?> javaType, java.lang.String fieldName)
DirectToFieldMapping
(@Basic) mapping to be added to a
dynamic type through API. This method can be used on a new
DynamicTypeImpl
that has yet to be added to a session and have
its descriptor initialized, or it can be called on an active
(initialized) descriptor.
There is no support currently for having the EclipseLink
SchemaManager
generate ALTER TABLE calls so any new columns
expected must be added without the help of EclipseLink or use the
SchemaManager.replaceObject(org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition)
to DROP and CREATE the table. WARNING: This will cause data loss.
javaType
- is the type of the attribute. If the type is a primitive it
will be converted to the comparable non-primitive type.public OneToOneMapping addOneToOneMapping(java.lang.String name, DynamicType refType, java.lang.String... fkFieldNames)
OneToOneMapping
(@OneToOne and @ManyToOne) mappings to be
added to a dynamic type through API. This method can be used on a new
DynamicTypeImpl
that has yet to be added to a session and have
its descriptor initialized, or it can be called on an active
(initialized) descriptor.
There is no support currently for having the EclipseLink
SchemaManager
generate ALTER TABLE calls so any new columns
expected must be added without the help of EclipseLink or use the
SchemaManager.replaceObject(org.eclipse.persistence.tools.schemaframework.DatabaseObjectDefinition)
to DROP and CREATE the table. WARNING: This will cause data loss.
public OneToManyMapping addOneToManyMapping(java.lang.String name, DynamicType refType, java.lang.String... fkFieldNames)
name
- refType
- fkFieldNames
-
public DirectCollectionMapping addDirectCollectionMapping(java.lang.String name, java.lang.String targetTable, java.lang.String valueColumn, java.lang.Class<?> valueType, java.lang.String... fkFieldNames) throws java.lang.IllegalArgumentException
name
- targetTable
- valueColumn
- valueType
- fkFieldNames
-
java.lang.IllegalArgumentException
public AggregateObjectMapping addAggregateObjectMapping(java.lang.String name, DynamicType refType, boolean allowsNull)
name
- refType
- allowsNull
-
public void addManyToManyMapping(java.lang.String name, DynamicType refType, java.lang.String relationshipTableName)
name
- refType
- relationshipTableName
- protected DatabaseMapping addMapping(DatabaseMapping mapping)
ValuesAccessor
is created and the position of the mapping in the
descriptor is captured to use as its index.
public void configureSequencing(java.lang.String numberName, java.lang.String numberFieldName)
public void configureSequencing(Sequence sequence, java.lang.String numberName, java.lang.String numberFieldName)
public static Project loadDynamicProject(java.lang.String resourcePath, DatabaseLogin login, DynamicClassLoader dynamicClassLoader) throws java.io.IOException
resourcePath
- login
- dynamicClassLoader
-
DynamicClassLoader
and associated
DynamicClassWriter
configured. Ensure if a new
Login/Platform is being configured that the
ConversionManager.getLoader()
is maintained.
null is returned if the resourcePath cannot locate a deployment XML
java.io.IOException
public static Project loadDynamicProject(java.io.InputStream resourceStream, DatabaseLogin login, DynamicClassLoader dynamicClassLoader) throws java.io.IOException
resourceStream
- login
- dynamicClassLoader
-
DynamicClassLoader
and associated
DynamicClassWriter
configured. Ensure if a new
Login/Platform is being configured that the
ConversionManager.getLoader()
is maintained.
null is returned if the resourcePath cannot locate a deployment XML
java.io.IOException
|
EclipseLink 1.2.0, build 'v20091016-r5565' API Reference | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |