Interface UnknownColumnHandler


public interface UnknownColumnHandler
A handler for columns in a result set that are not mapped to any property in an entity.

This interface defines how to handle situations where a column in a database result set doesn't correspond to any property in the entity class being used for mapping. Implementations can choose to ignore unknown columns, throw exceptions, or handle them in custom ways.

The default implementation throws an UnknownColumnException when an unknown column is encountered, providing detailed information about the mismatch.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    handle(Query query, EntityType<?> entityType, String unknownColumnName)
    Deprecated, for removal: This API element is subject to removal in a future version.
    This method has been deprecated in favor of handle(Query, EntityType, String, Supplier) which provides additional context information about the unknown column.
    default void
    handle(Query query, EntityType<?> entityType, String unknownColumnName, Supplier<String> informationSupplier)
    Handles an unknown column during query execution.
  • Method Details

    • handle

      @Deprecated(forRemoval=true) default void handle(Query query, EntityType<?> entityType, String unknownColumnName)
      Deprecated, for removal: This API element is subject to removal in a future version.
      This method has been deprecated in favor of handle(Query, EntityType, String, Supplier) which provides additional context information about the unknown column. Will be removed in a future version.
      Handles the unknown column.

      This method is called when a column in a result set doesn't match any property in the entity being mapped. The default implementation throws an UnknownColumnException with detailed information about the mismatch.

      Parameters:
      query - the query being executed
      entityType - the entity type containing metadata about the entity
      unknownColumnName - the name of the unknown column
      Throws:
      UnknownColumnException - if this handler does not allow the unknown column
    • handle

      default void handle(Query query, EntityType<?> entityType, String unknownColumnName, Supplier<String> informationSupplier)
      Handles an unknown column during query execution. Provides additional information for the exception when the column is unrecognized by the entity.
      Parameters:
      query - the query being executed
      entityType - the entity type containing the metadata about the entity
      unknownColumnName - the name of the column that is unknown
      informationSupplier - the supplier that provides additional information about the unknown column
      Throws:
      UnknownColumnAdditionalInfoException - if the unknown column cannot be handled