Package database.datasource
Class SqlJpaConn
java.lang.Object
database.datasource.SqlJpaConn
Singleton classs, that creates EntityManager,
which handles the connection between the database and the program
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static jakarta.persistence.EntityManagerEntityManager handles the connection between the database and the program.private static jakarta.persistence.EntityManagerFactoryEntityManageFactory creates the EntityManager.static booleanif sql connection fails, this is set to true and no more attempts are made. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic jakarta.persistence.EntityManagerSingleton constructor, which creates the entitymanager if it doesn't exist or returns it if it already exists.
-
Field Details
-
emf
private static jakarta.persistence.EntityManagerFactory emfEntityManageFactory creates the EntityManager. -
em
private static jakarta.persistence.EntityManager emEntityManager handles the connection between the database and the program. -
failedToConnect
public static boolean failedToConnectif 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
-