Package tech.ailef.dbadmin.external
Class DbAdmin
java.lang.Object
tech.ailef.dbadmin.external.DbAdmin
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 Summary
ConstructorsConstructorDescriptionDbAdmin
(jakarta.persistence.EntityManager entityManager, DbAdminProperties properties) -
Method Summary
Modifier and TypeMethodDescriptionfindSchemaByClass
(Class<?> klass) Finds a schema by its classfindSchemaByClassName
(String className) Finds a schema by its full class namefindSchemaByTableName
(String tableName) Finds a schema by its table nameReturns all the loaded schemas (i.e.
-
Constructor Details
-
DbAdmin
public DbAdmin(@Autowired jakarta.persistence.EntityManager entityManager, @Autowired DbAdminProperties properties)
-
-
Method Details
-
getSchemas
Returns all the loaded schemas (i.e. entity classes)- Returns:
-
findSchemaByClassName
Finds a schema by its full class name- Parameters:
className
- qualified class name- Returns:
- Throws:
DbAdminException
- if corresponding schema not found
-
findSchemaByTableName
Finds a schema by its table name- Parameters:
tableName
- the table name on the database- Returns:
- Throws:
DbAdminException
- if corresponding schema not found
-
findSchemaByClass
Finds a schema by its class- Parameters:
klass
-- Returns:
- Throws:
DbAdminException
- if corresponding schema not found
-