
com.devonfw.module.jpa.dataaccess.api.JpaInitializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of devon4j-jpa-basic Show documentation
Show all versions of devon4j-jpa-basic Show documentation
JPA-based persistence infrastructure of the Open Application Standard Platform for Java (devon4j).
package com.devonfw.module.jpa.dataaccess.api;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
/**
* Initializer bean for {@link EntityManager}. Will be auto configured via {@code devon4j-starter-jpa}.
*
* @since 3.0.0
*/
public class JpaInitializer {
/**
* @param entityManager the {@link EntityManager} to inject.
*/
@PersistenceContext
protected void setEntityManager(EntityManager entityManager) {
JpaEntityManagerAccess.setEntityManager(entityManager, true);
}
/**
* @param entityManager the {@link EntityManager} to set.
* @param check - {@code true} to check that the {@link EntityManager} does not change on-the-fly (desired in
* productive code), {@code false} otherwise (may be desired in test-code).
*/
protected void setEntityManager(EntityManager entityManager, boolean check) {
JpaEntityManagerAccess.setEntityManager(entityManager, check);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy