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

public class AnyMapping<T> extends Object
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:
  • Any
  • ManyToAny
  • Constructor Summary

    Constructors
    Constructor
    Description
    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 of AnyMapping.
  • Method Summary

    Modifier and Type
    Method
    Description
    org.fastnate.generator.context.GeneratorColumn
    The column that contains the identifier of the type disciminator.
    getPredicate(T value)
    Builds a predicate to find the row with the given value.
    void
    setColumnValue(org.fastnate.generator.statements.TableStatement statement, T value)
    Sets the mapping value for the given value to the statement.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 of AnyMapping.
      Parameters:
      context - the current generation context
      attribute - the attribute that this mapping is attached to
      containerTable - the table that contains the discriminator column
      attributeOverride - contains the optional attribute overrides for the discriminator column
  • Method Details

    • getPredicate

      public String getPredicate(T value)
      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

      public void setColumnValue(org.fastnate.generator.statements.TableStatement statement, T value)
      Sets the mapping value for the given value to the statement.
      Parameters:
      statement - the statement of the current row
      value - the value of the current row
    • getColumn

      public org.fastnate.generator.context.GeneratorColumn getColumn()
      The column that contains the identifier of the type disciminator.