Class SqlJpaConn

java.lang.Object
database.datasource.SqlJpaConn

public class SqlJpaConn extends Object
Singleton classs, that creates EntityManager, which handles the connection between the database and the program
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static jakarta.persistence.EntityManager
    EntityManager handles the connection between the database and the program.
    private static jakarta.persistence.EntityManagerFactory
    EntityManageFactory creates the EntityManager.
    static boolean
    if sql connection fails, this is set to true and no more attempts are made.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    private static Map<String,Object>
     
    static jakarta.persistence.EntityManager
    Singleton constructor, which creates the entitymanager if it doesn't exist or returns it if it already exists.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • emf

      private static jakarta.persistence.EntityManagerFactory emf
      EntityManageFactory creates the EntityManager.
    • em

      private static jakarta.persistence.EntityManager em
      EntityManager handles the connection between the database and the program.
    • failedToConnect

      public static boolean failedToConnect
      if sql connection fails, this is set to true and no more attempts are made.
  • Constructor Details

    • SqlJpaConn

      public SqlJpaConn()
  • Method Details

    • getInstance

      public static jakarta.persistence.EntityManager getInstance()
      Singleton constructor, which creates the entitymanager if it doesn't exist or returns it if it already exists.
      Returns:
      returns the EntityManager
    • configOverider

      private static Map<String,Object> configOverider()