Package org.fastnate.hibernate
Class AnyMapping<T>
java.lang.Object
org.fastnate.hibernate.AnyMapping<T>
- Type Parameters:
T- the type of the attribute that this mapping is attached to
A column that is responsible to store the information for references to arbitrary entity types that are stored in the
same attribute.
- Author:
- Tobias Liefke
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionAnyMapping(org.fastnate.generator.context.GeneratorContext context, org.fastnate.generator.context.AttributeAccessor attribute, org.fastnate.generator.context.GeneratorTable containerTable, jakarta.persistence.AttributeOverride attributeOverride) Creates a new instance ofAnyMapping. -
Method Summary
Modifier and TypeMethodDescriptionorg.fastnate.generator.context.GeneratorColumnThe column that contains the identifier of the type disciminator.getPredicate(T value) Builds a predicate to find the row with the given value.voidsetColumnValue(org.fastnate.generator.statements.TableStatement statement, T value) Sets the mapping value for the given value to the statement.
-
Constructor Details
-
AnyMapping
public AnyMapping(org.fastnate.generator.context.GeneratorContext context, org.fastnate.generator.context.AttributeAccessor attribute, org.fastnate.generator.context.GeneratorTable containerTable, jakarta.persistence.AttributeOverride attributeOverride) Creates a new instance ofAnyMapping.- Parameters:
context- the current generation contextattribute- the attribute that this mapping is attached tocontainerTable- the table that contains the discriminator columnattributeOverride- contains the optional attribute overrides for the discriminator column
-
-
Method Details
-
getPredicate
Builds a predicate to find the row with the given value. Does only work with an additional predicate for the id.- Parameters:
value- the current value to find as row- Returns:
- the predicate to find all rows with the same type of value
-
setColumnValue
Sets the mapping value for the given value to the statement.- Parameters:
statement- the statement of the current rowvalue- the value of the current row
-
getColumn
public org.fastnate.generator.context.GeneratorColumn getColumn()The column that contains the identifier of the type disciminator.
-