All Known Subinterfaces:
SimpleIdMapperBuilder
All Known Implementing Classes:
AbstractCompositeIdMapper, AbstractIdMapper, EmbeddedIdMapper, MultipleIdMapper, NestedEmbeddedIdMapper, SingleIdMapper, VirtualEntitySingleIdMapper

public interface IdMapper
Base contract for all identifier mappers.
  • Method Details

    • getServiceRegistry

      ServiceRegistry getServiceRegistry()
    • mapToMapFromId

      void mapToMapFromId(Map<String,Object> data, Object obj)
    • mapToMapFromId

      default void mapToMapFromId(Session session, Map<String,Object> data, Object obj)
    • mapToMapFromEntity

      void mapToMapFromEntity(Map<String,Object> data, Object obj)
    • mapToEntityFromMap

      boolean mapToEntityFromMap(Object obj, Map data)
      Parameters:
      obj - Object to map to.
      data - Data to map.
      Returns:
      True if data was mapped; false otherwise (when the id is null).
    • mapToIdFromEntity

      Object mapToIdFromEntity(Object data)
    • mapToIdFromMap

      Object mapToIdFromMap(Map data)
    • prefixMappedProperties

      IdMapper prefixMappedProperties(String prefix)
      Creates a mapper with all mapped properties prefixed. A mapped property is a property which is directly mapped to values (not composite).
      Parameters:
      prefix - Prefix to add to mapped properties
      Returns:
      A copy of the current property mapper, with mapped properties prefixed.
    • mapToQueryParametersFromId

      List<QueryParameterData> mapToQueryParametersFromId(Object obj)
      Parameters:
      obj - Id from which to map.
      Returns:
      A set parameter data, needed to build a query basing on the given id.
    • addIdsEqualToQuery

      void addIdsEqualToQuery(Parameters parameters, String prefix1, String prefix2)
      Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 (the entity is the same).
      Parameters:
      parameters - Parameters, to which to add the statements.
      prefix1 - First alias of the entity + prefix to add to the properties.
      prefix2 - Second alias of the entity + prefix to add to the properties.
    • addIdsEqualToQuery

      void addIdsEqualToQuery(Parameters parameters, String prefix1, IdMapper mapper2, String prefix2)
      Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 mapped by the second mapper (the second mapper must be for the same entity, but it can have, for example, prefixed properties).
      Parameters:
      parameters - Parameters, to which to add the statements.
      prefix1 - First alias of the entity + prefix to add to the properties.
      mapper2 - Second mapper for the same entity, which will be used to get properties for the right side of the equation.
      prefix2 - Second alias of the entity + prefix to add to the properties.
    • addNullableIdsEqualToQuery

      void addNullableIdsEqualToQuery(Parameters parameters, String prefix1, IdMapper mapper2, String prefix2)
      Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix1, is equal to the id of the entity with alias prefix2 mapped by the second mapper (the second mapper must be for the same entity, but it can have, for example, prefixed properties).
      Parameters:
      parameters - Parameters, to which to add the statements.
      prefix1 - First alias of the entity + prefix to add to the properties.
      mapper2 - Second mapper for the same entity, which will be used to get properties for the right side of the equation.
      prefix2 - Second alias of the entity + prefix to add to the properties.
    • addIdEqualsToQuery

      void addIdEqualsToQuery(Parameters parameters, Object id, String alias, String prefix, boolean equals)
      Adds query statements, which contains restrictions, which express the property that the id of the entity with alias prefix, is equal to the given object.
      Parameters:
      parameters - Parameters, to which to add the statements.
      id - Value of id.
      alias - the alias to use in the specified parameters (may be null).
      prefix - Prefix to add to the properties (may be null).
      equals - Should this query express the "=" relation or the "<>" relation.
    • addNamedIdEqualsToQuery

      void addNamedIdEqualsToQuery(Parameters parameters, String prefix, boolean equals)
      Adds query statements, which contains named parameters, which express the property that the id of the entity with alias prefix, is equal to the given object. It is the responsibility of the using method to read parameter values from the id and specify them on the final query object.
      Parameters:
      parameters - Parameters, to which to add the statements.
      prefix - Prefix to add to the properties (may be null).
      equals - Should this query express the "=" relation or the "<>" relation.
    • addNamedIdEqualsToQuery

      void addNamedIdEqualsToQuery(Parameters parameters, String prefix, IdMapper mapper, boolean equals)
      Adds query statements, which contains named parameters that express the property that the id of the entity with alias prefix is equal to the given object using the specified mapper.
      Parameters:
      parameters - Parameters, to which to add the statements.
      prefix - Prefix to add to the properties (may be null).
      mapper - The identifier mapper to use
      equals - Should this query express the "=" relation or the "<>" relation.
      Since:
      5.2.2