Class SkinnedRatOrmEntityManager
java.lang.Object
com.serinity.accesscontrol.config.SkinnedRatOrmEntityManager
Configuration utility class responsible for providing database connections
and initializing the SkinnedRat ORM
EntityManager.
This class centralizes the creation and configuration of JDBC connections
using environment variables loaded via EnvironmentVariableLoader.
It ensures that the appropriate JDBC driver is loaded before creating
the ORM EntityManager.
Responsibilities:
- Establishing a JDBC
Connection - Enabling auto-commit mode for database transactions
- Loading the configured JDBC driver class
- Providing a fully initialized
EntityManager
If a database connection cannot be established or the JDBC driver
cannot be found, the underlying exception is wrapped and rethrown
as a RuntimeException.
This class uses static factory methods and does not require instantiation.
- Since:
- 2026-02-16 SkinnedRatOrmEntityManager.java
- Version:
- 1.0
- Author:
- @ZouariOmar (zouariomar20@gmail.com)
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConnectionCreates and returns a new JDBCConnectionusing credentials loaded from environment variables, with auto-commit enabled.static org.zouarioss.skinnedratorm.core.EntityManagerLoads the configured JDBC driver and returns an initializedEntityManagerbacked by a fresh database connection.
-
Method Details
-
getConnection
Creates and returns a new JDBCConnectionusing credentials loaded from environment variables, with auto-commit enabled.- Returns:
- a new
Connectionready for use - Throws:
RuntimeException- if the connection cannot be established
-
getEntityManager
public static org.zouarioss.skinnedratorm.core.EntityManager getEntityManager()Loads the configured JDBC driver and returns an initializedEntityManagerbacked by a fresh database connection.- Returns:
- a fully configured
EntityManager - Throws:
RuntimeException- if the JDBC driver class is not found or the connection cannot be established
-