Class SkinnedRatOrmEntityManager

java.lang.Object
com.serinity.accesscontrol.config.SkinnedRatOrmEntityManager

public class SkinnedRatOrmEntityManager extends Object
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 Details

    • getConnection

      public static Connection getConnection()
      Creates and returns a new JDBC Connection using credentials loaded from environment variables, with auto-commit enabled.
      Returns:
      a new Connection ready 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 initialized EntityManager backed 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