Package org.fastnate.generator.converter
Class EntityConverter
java.lang.Object
org.fastnate.generator.converter.EntityConverter
- All Implemented Interfaces:
ValueConverter<Object>
Converts the reference to an entity to an expression that uses the sequence value of that entity.
- Author:
- Tobias Liefke
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ColumnExpressiongetEntityReference(Object entity, String mappedId, GeneratorContext context, boolean whereExpression) Creates an expression for an entity.getExpression(Object value, GeneratorContext context) Builds the expression for writing the given value into an SQL clause.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.fastnate.generator.converter.ValueConverter
getExpression
-
Constructor Details
-
EntityConverter
public EntityConverter()
-
-
Method Details
-
getEntityReference
public static ColumnExpression getEntityReference(Object entity, String mappedId, GeneratorContext context, boolean whereExpression) Creates an expression for an entity.- Parameters:
entity- the entitymappedId- the property that contains the id, only interesting if the id is anEmbeddedPropertycontext- the current database contextwhereExpression- indicates that the reference is used in a "where" statement- Returns:
- the expression using the sequence of that entity or
nullif the entity was not written up to now
-
getExpression
Description copied from interface:ValueConverterBuilds the expression for writing the given value into an SQL clause.- Specified by:
getExpressionin interfaceValueConverter<Object>- Parameters:
value- the current valuecontext- the current context (contains the database dialect).- Returns:
- the expression (that is including surrounding ' for string literals)
-