public class GeneratorContext extends Object
EntitySqlGenerators.| Modifier and Type | Field and Description |
|---|---|
static String |
DIALECT_KEY
The settings key for the target SQL dialect.
|
static String |
NULL_VALUES_KEY
The settings key for
writeNullValues. |
static String |
PERSISTENCE_FILE_KEY
The settings key for the path to the persistence.xml, either relative to the current directory or absolute.
|
static String |
PERSISTENCE_UNIT_KEY
The settings key for the name of the persistence unit in the persistence.xml.
|
static String |
PREFER_SEQUENCE_CURRENT_VALUE
The settings key for
preferSequenceCurentValue. |
static String |
PROVIDER_KEY
The settings key for the JPA provider.
|
static String |
RELATIVE_IDS_KEY
The settings key for
writeRelativeIds. |
static String |
UNIQUE_PROPERTIES_MAX_KEY
The settings key for the
maxUniqueProperties. |
static String |
UNIQUE_PROPERTIES_QUALITY_KEY
The settings key for the
uniquePropertyQuality. |
| Constructor and Description |
|---|
GeneratorContext()
Creates a default generator context.
|
GeneratorContext(GeneratorDialect dialect)
Creates a generator context for a dialect.
|
GeneratorContext(Properties settings)
Creates a new instance of
GeneratorContext. |
| Modifier and Type | Method and Description |
|---|---|
List<EntityStatement> |
getAlignmentStatements()
Builds all statements that are necessary to align ID generators in the database with the current IDs.
|
<E> EntityClass<E> |
getDescription(Class<E> entityClass)
Finds the description for a class.
|
<E> EntityClass<E> |
getDescription(E entity)
Finds the description for the class of an entity.
|
IdGenerator |
getGenerator(javax.persistence.GeneratedValue generatedValue,
String table,
String column)
Finds the correct generator for the given annotation.
|
void |
registerGenerators(AnnotatedElement element)
Registers the
TableGenerator and SequenceGenerator declared at the given element. |
public static final String PROVIDER_KEY
JpaProvider or the simple name of one
of the classes from org.fastnate.generator.provider.
Defaults to HibernateProvider.public static final String PERSISTENCE_FILE_KEY
public static final String PERSISTENCE_UNIT_KEY
public static final String DIALECT_KEY
Contains either the fully qualified name of a class that extends GeneratorDialect or the simple class
name of one of the classes from org.fastnate.generator.dialect. The suffix 'Dialect' may be omitted in
that case. For example 'MySql' would map to org.fastnate.generator.dialect.MySqlDialect.
If no dialect is set explicitly then the configured persistence.xml is scanned for
a connection URL or provider specific dialect, which would be converted to our known dialects.
If nothing is found, H2 is used as default.
public static final String NULL_VALUES_KEY
writeNullValues.public static final String RELATIVE_IDS_KEY
writeRelativeIds.public static final String UNIQUE_PROPERTIES_QUALITY_KEY
uniquePropertyQuality.public static final String UNIQUE_PROPERTIES_MAX_KEY
maxUniqueProperties.public static final String PREFER_SEQUENCE_CURRENT_VALUE
preferSequenceCurentValue.public GeneratorContext()
public GeneratorContext(GeneratorDialect dialect)
dialect - the database dialect to use during generationpublic GeneratorContext(Properties settings)
GeneratorContext.settings - contains the settingspublic List<EntityStatement> getAlignmentStatements()
public <E> EntityClass<E> getDescription(Class<E> entityClass)
entityClass - the class to lookupnull if the class is not an Entitypublic <E> EntityClass<E> getDescription(E entity)
entity - the entity to lookupIllegalArgumentException - if the given object is no Entitypublic IdGenerator getGenerator(javax.persistence.GeneratedValue generatedValue, String table, String column)
generatedValue - the annotation of the current primary keytable - the name of the current tablecolumn - the name of the current columnpublic void registerGenerators(AnnotatedElement element)
TableGenerator and SequenceGenerator declared at the given element.
If neither annotation is present, nothing happens.element - the inspected class, method or fieldCopyright © 2016 fastnate.org. All rights reserved.