
net.cassite.daf4j.jpa.JPATxManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of daf4j-ds-jpa Show documentation
Show all versions of daf4j-ds-jpa Show documentation
A library provides implementation of DAF4J DataAccess using JPA
The newest version!
package net.cassite.daf4j.jpa;
import net.cassite.daf4j.ds.TxManager;
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
/**
* JPA的事务管理器
*/
public class JPATxManager implements TxManager {
private final EntityManager entityManager;
private EntityTransaction tx;
public JPATxManager(EntityManager entityManager){
this.entityManager=entityManager;
}
@Override
public void txBegin() {
tx=entityManager.getTransaction();
tx.begin();
}
@Override
public void txCommit() {
tx.commit();
}
@Override
public void txRollback() {
tx.rollback();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy