Class DbAdmin

java.lang.Object
tech.ailef.dbadmin.external.DbAdmin

@Component public class DbAdmin extends Object
The main DbAdmin class responsible for the initialization phase. This class scans the user provided package containing the `@Entity` definitions and tries to map each entity to a DbObjectSchema instance. This process involves determining the correct type for each class field and its configuration at the database level. An exception will be thrown if it's not possible to determine the field type.
  • Constructor Details

    • DbAdmin

      public DbAdmin(@Autowired jakarta.persistence.EntityManager entityManager, @Autowired DbAdminProperties properties)
  • Method Details

    • getSchemas

      public List<DbObjectSchema> getSchemas()
      Returns all the loaded schemas (i.e. entity classes)
      Returns:
    • findSchemaByClassName

      public DbObjectSchema findSchemaByClassName(String className)
      Finds a schema by its full class name
      Parameters:
      className - qualified class name
      Returns:
      Throws:
      DbAdminException - if corresponding schema not found
    • findSchemaByTableName

      public DbObjectSchema findSchemaByTableName(String tableName)
      Finds a schema by its table name
      Parameters:
      tableName - the table name on the database
      Returns:
      Throws:
      DbAdminException - if corresponding schema not found
    • findSchemaByClass

      public DbObjectSchema findSchemaByClass(Class<?> klass)
      Finds a schema by its class
      Parameters:
      klass -
      Returns:
      Throws:
      DbAdminException - if corresponding schema not found