Class EntityPersistent

java.lang.Object
io.github.blyznytsiaorg.bibernate.entity.EntityPersistent

public class EntityPersistent extends Object
Provides functionality for mapping data from a ResultSet to an entity object. This class facilitates the process of converting database query results into corresponding entity objects.
Since:
1.0
Author:
Blyzhnytsia Team
  • Field Details

    • typeResolverFactory

      private final TypeResolverFactory typeResolverFactory
    • ignoredRelationFields

      private final List<String> ignoredRelationFields
  • Constructor Details

    • EntityPersistent

      public EntityPersistent()
  • Method Details

    • toEntity

      public <T> T toEntity(ResultSet resultSet, Class<T> entityClass) throws ReflectiveOperationException
      Converts data from a ResultSet into an entity object of the specified class.
      Type Parameters:
      T - The type of the entity.
      Parameters:
      resultSet - The ResultSet containing the data to be mapped.
      entityClass - The class of the entity to be instantiated.
      Returns:
      An instance of the entity class populated with data from the ResultSet.
      Throws:
      ReflectiveOperationException - If an error occurs during reflection-based operations.
    • setFieldDependency

      private <T> void setFieldDependency(TypeFieldResolver valueType, Field field, T entity, ResultSet resultSet)
    • addIgnoredRelationFields

      public void addIgnoredRelationFields(List<String> fieldNames)
      Adds the specified field names to the list of ignored relation fields.
      Parameters:
      fieldNames - The names of the fields to be ignored.
    • clearIgnoredRelationFields

      public void clearIgnoredRelationFields()
      Clears the list of ignored relation fields.