E
- The type of the container entityT
- The type of the target entitypublic class EntityProperty<E,T> extends SingularProperty<E,T>
EntityClass
that references another entity.Constructor and Description |
---|
EntityProperty(GeneratorContext context,
AttributeAccessor attribute,
javax.persistence.AssociationOverride override)
Creates a new instance of
EntityProperty . |
Modifier and Type | Method and Description |
---|---|
void |
addInsertExpression(E entity,
InsertStatement statement)
Adds an expression according to the current value of the property for the given entity to an SQL insert
statement.
|
Collection<?> |
findReferencedEntities(E entity)
Finds all entities in the current property, that are referenced.
|
List<EntityStatement> |
generatePendingStatements(E entity,
Object writtenEntity,
Object... arguments)
Generates the update statements for an entity that are required after another entity was generated.
|
String |
getExpression(E entity,
boolean whereExpression)
Creates the expression for the current value of the given entity in SQL.
|
String |
getPredicate(E entity)
Creates an SQL predicate that references all entities that have the same value as the given entity.
|
boolean |
isTableColumn()
Indicates that this property maps to a column from the parent table.
|
getColumn
createPostInsertStatements, createPreInsertStatements, failIfRequired, getName, getValue, isRequired, setValue, toString
public EntityProperty(GeneratorContext context, AttributeAccessor attribute, @Nullable javax.persistence.AssociationOverride override)
EntityProperty
.context
- the generator context.attribute
- the accessor of the attributeoverride
- optional AttributeOverride
configuration.public void addInsertExpression(E entity, InsertStatement statement)
Property
addInsertExpression
in class Property<E,T>
entity
- the inspected entitystatement
- the created statementpublic Collection<?> findReferencedEntities(E entity)
Property
findReferencedEntities
in class Property<E,T>
entity
- the inspected entitypublic List<EntityStatement> generatePendingStatements(E entity, Object writtenEntity, Object... arguments)
Property
EntityClass.markPendingUpdates(E, V, org.fastnate.generator.context.Property<V, ?>, java.lang.Object...)
was called before for writtenEntity
generatePendingStatements
in class Property<E,T>
entity
- the entity that needs to be updatedwrittenEntity
- the entity that exists now in the databasearguments
- additional arguments that where given to markPendingUpdatespublic String getExpression(E entity, boolean whereExpression)
Property
getExpression
in class Property<E,T>
entity
- the entitywhereExpression
- indicates that the expression is used in a "where" statementnull
if no existspublic String getPredicate(E entity)
Property
getPredicate
in class Property<E,T>
entity
- the entitynull
if no such expression is availablepublic boolean isTableColumn()
Property
isTableColumn
in class SingularProperty<E,T>
true
if Property.addInsertExpression(Object, InsertStatement)
will add the corresponding value to
the given statementCopyright © 2016 fastnate.org. All rights reserved.