/**
* {@inheritDoc}
*/
@Override
public boolean updateEntity(long id, Order entity) {
boolean found = false;
EntityManager em = getEM();
try {
em.getTransaction().begin();
PersistenceOrder order = em.find(getEntityClass(), id);
if (order != null) {
order.setTime(entity.getTime());
order.setTotalPriceInCents(entity.getTotalPriceInCents());
order.setAddressName(entity.getAddressName());
order.setAddress1(entity.getAddress1());
order.setAddress2(entity.getAddress2());
order.setCreditCardCompany(entity.getCreditCardCompany());
order.setCreditCardNumber(entity.getCreditCardNumber());
order.setCreditCardExpiryDate(entity.getCreditCardExpiryDate());
found = true;
}
em.getTransaction().commit();
} finally {
em.close();
}
return found;
}
java类javax.persistence.EntityManager的实例源码
OrderRepository.java 文件源码
项目:Pet-Supply-Store
阅读 34
收藏 0
点赞 0
评论 0
CustomJpaRepositoryFactory.java 文件源码
项目:OperatieBRP
阅读 44
收藏 0
点赞 0
评论 0
@Override
@SuppressWarnings({"unchecked", "rawtypes"})
protected SimpleJpaRepository<?, ?> getTargetRepository(
final RepositoryMetadata metadata,
final EntityManager entityManager) {
final Class<?> repositoryInterface = metadata.getRepositoryInterface();
final JpaEntityInformation<?, Serializable> entityInformation = getEntityInformation(metadata.getDomainType());
if (isQueryDslSpecificExecutor(repositoryInterface)) {
throw new IllegalArgumentException("QueryDSL interface niet toegestaan");
}
return isMaxedRepository(repositoryInterface)
? new CustomSimpleMaxedJpaRepository(entityInformation, entityManager)
: isQuerycostRepository(repositoryInterface)
? new CustomSimpleQuerycostJpaRepository(entityInformation, entityManager, maxCostsQueryPlan)
: new CustomSimpleJpaRepository(entityInformation, entityManager);
}
ZipContentParserTest.java 文件源码
项目:Mod-Tools
阅读 34
收藏 0
点赞 0
评论 0
/**
* Test of handle method, of class ZipContentParser.
*/
@Test
public void testHandle() {
System.out.println("handle");
try {
EntityManager manager = new PersistenceProvider().get();
if(!manager.getTransaction().isActive()) {
manager.getTransaction().begin();
}
manager.persist(new Modification("ZipContentParserTest.mod",31));
manager.getTransaction().commit();
IOUtils.copy(getClass().getResourceAsStream("/test.zip"), FileUtils.openOutputStream(new File(getAllowedFolder()+"/a.zip")));
List <ProcessTask> result = get().handle(manager);
Assert.assertTrue(
"result is not of correct type",
result instanceof List<?>
);
Assert.assertEquals(
"Unexpected follow-ups",
0,
result.size()
);
} catch(Exception ex) {
Assert.fail(ex.getMessage());
}
}
ForceDeleteDSTask.java 文件源码
项目:osc-core
阅读 33
收藏 0
点赞 0
评论 0
@Override
public void executeTransaction(EntityManager em) {
log.info("Force Deleting Deployment Specification: " + this.ds.getName());
// load deployment spec from database to avoid lazy loading issues
this.ds = DeploymentSpecEntityMgr.findById(em, this.ds.getId());
// remove DAI(s) for this ds
for (DistributedApplianceInstance dai : this.ds.getDistributedApplianceInstances()) {
dai.getProtectedPorts().clear();
OSCEntityManager.delete(em, dai, this.txBroadcastUtil);
}
// remove the sg reference from database
if (this.ds.getVirtualSystem().getVirtualizationConnector().getVirtualizationType().isOpenstack()) {
boolean osSgCanBeDeleted = DeploymentSpecEntityMgr.findDeploymentSpecsByVirtualSystemProjectAndRegion(em,
this.ds.getVirtualSystem(), this.ds.getProjectId(), this.ds.getRegion()).size() <= 1;
if (osSgCanBeDeleted && this.ds.getOsSecurityGroupReference() != null) {
OSCEntityManager.delete(em, this.ds.getOsSecurityGroupReference(), this.txBroadcastUtil);
}
}
// delete DS from the database
OSCEntityManager.delete(em, this.ds, this.txBroadcastUtil);
}
UserDAO.java 文件源码
项目:bibliometrics
阅读 43
收藏 0
点赞 0
评论 0
public static User getUser(String username) {
EntityManagerFactory emf = Persistence.createEntityManagerFactory("userData");
EntityManager em = emf.createEntityManager();
EntityTransaction tx = em.getTransaction();
tx.begin();
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<User> q = cb.createQuery(User.class);
Root<User> c = q.from(User.class);
q.select(c).where(cb.equal(c.get("username"), username));
TypedQuery<User> query = em.createQuery(q);
List<User> users = query.getResultList();
em.close();
LOGGER.info("found " + users.size() + " users with username " + username);
if (users.size() == 1)
return users.get(0);
else
return null;
}
ListJobService.java 文件源码
项目:osc-core
阅读 40
收藏 0
点赞 0
评论 0
@Override
public ListResponse<JobRecordDto> exec(ListJobRequest request, EntityManager em) throws Exception {
ListResponse<JobRecordDto> response = new ListResponse<JobRecordDto>();
// Initializing Entity Manager
OSCEntityManager<JobRecord> emgr = new OSCEntityManager<JobRecord>(JobRecord.class, em, this.txBroadcastUtil);
// to do mapping
List<JobRecordDto> dtoList = new ArrayList<JobRecordDto>();
// mapping all the job objects to job dto objects
for (JobRecord j : emgr.listAll(false, "id")) {
JobRecordDto dto = new JobRecordDto();
JobEntityManager.fromEntity(j, dto);
dtoList.add(dto);
}
response.setList(dtoList);
return response;
}
CoreTaskService.java 文件源码
项目:comms-router
阅读 39
收藏 0
点赞 0
评论 0
private void cancelTask(EntityManager em, RouterObjectRef taskRef)
throws NotFoundException, InvalidStateException {
Task task = app.db.task.get(em, taskRef);
switch (task.getState()) {
case waiting:
assert task.getAgent() == null : "Waiting task " + task.getRef() + " has assigned agent: "
+ task.getAgent().getRef();
task.makeCanceled();
return;
case canceled:
throw new InvalidStateException("Task already canceled");
case assigned:
case completed:
default:
throw new InvalidStateException(
"Current state cannot be switched to canceled: " + task.getState());
}
}
ClientPipelineDataAccessObject.java 文件源码
项目:full-javaee-app
阅读 36
收藏 0
点赞 0
评论 0
public static ClientPipelines persist (ClientPipelines elt) {
if (elt != null) {
EntityManager em = EMFUtil.getEMFactory().createEntityManager();
EntityTransaction trans = em.getTransaction();
try {
trans.begin();
em.persist(elt);
trans.commit();
return elt;
} catch (Exception e) {
e.printStackTrace();
trans.rollback();
}
}
return null;
}
TaskServiceImplTest.java 文件源码
项目:aries-jpa
阅读 35
收藏 0
点赞 0
评论 0
@Test
public void testPersistence() {
// Make sure derby.log is in target
System.setProperty("derby.stream.error.file", "target/derby.log");
TaskServiceImpl taskServiceImpl = new TaskServiceImpl();
EntityManagerFactory emf = createTestEMF();
final EntityManager em = emf.createEntityManager();
em.getTransaction().begin();
taskServiceImpl.em = em;
TaskService taskService = taskServiceImpl;
Task task = new Task();
task.setId(1);
task.setTitle("test");
taskService.addTask(task);
Task task2 = taskService.getTask(1);
Assert.assertEquals(task.getTitle(), task2.getTitle());
em.getTransaction().commit();
em.close();
}
CompanyDataAccessObject.java 文件源码
项目:full-javaee-app
阅读 32
收藏 0
点赞 0
评论 0
public static Companies persist(Companies company) {
if (company != null) {
EntityManager em = EMFUtil.getEMFactory().createEntityManager();
EntityTransaction trans = em.getTransaction();
try {
trans.begin();
em.persist(company);
trans.commit();
return company;
} catch (Exception e) {
e.printStackTrace();
trans.rollback();
return null;
} finally {
em.close();
}
}
return null;
}
SecurityGroupEntityMgr.java 文件源码
项目:osc-core
阅读 36
收藏 0
点赞 0
评论 0
public static SecurityGroup listSecurityGroupsByVcIdAndMgrId(EntityManager em, Long vcId, String mgrId) {
CriteriaBuilder cb = em.getCriteriaBuilder();
CriteriaQuery<SecurityGroup> query = cb.createQuery(SecurityGroup.class);
Root<SecurityGroup> root = query.from(SecurityGroup.class);
query = query.select(root)
.where(cb.equal(root.join("virtualizationConnector").get("id"), vcId),
cb.equal(root.join("securityGroupInterfaces").get("mgrSecurityGroupId"), mgrId))
.orderBy(cb.asc(root.get("name")));
try {
return em.createQuery(query).getSingleResult();
} catch (NoResultException nre) {
return null;
}
}
DatabaseWrapper.java 文件源码
项目:SqlSauce
阅读 41
收藏 0
点赞 0
评论 0
/**
* Use this for COUNT() and similar sql queries which are guaranteed to return a result
*/
@Nonnull
@CheckReturnValue
public <T> T selectSqlQuerySingleResult(@Nonnull final String queryString,
@Nullable final Map<String, Object> parameters,
@Nonnull final Class<T> resultClass) throws DatabaseException {
final EntityManager em = this.databaseConnection.getEntityManager();
try {
final Query q = em.createNativeQuery(queryString);
if (parameters != null) {
parameters.forEach(q::setParameter);
}
em.getTransaction().begin();
final T result = resultClass.cast(q.getSingleResult());
em.getTransaction().commit();
return setSauce(result);
} catch (final PersistenceException | ClassCastException e) {
final String message = String.format("Failed to select single result plain SQL query %s with %s parameters for class %s on DB %s",
queryString, parameters != null ? parameters.size() : "null", resultClass.getName(), this.databaseConnection.getName());
throw new DatabaseException(message, e);
} finally {
em.close();
}
}
VmPortHookFailurePolicyUpdateTask.java 文件源码
项目:osc-core
阅读 31
收藏 0
点赞 0
评论 0
@Override
public void executeTransaction(EntityManager em) throws Exception {
this.vmPort = em.find(VMPort.class, this.vmPort.getId());
this.dai = em.find(DistributedApplianceInstance.class, this.dai.getId());
this.securityGroupInterface = em.find(SecurityGroupInterface.class,
this.securityGroupInterface.getId());
SdnRedirectionApi controller = this.apiFactoryService.createNetworkRedirectionApi(this.dai);
try {
DefaultNetworkPort ingressPort = new DefaultNetworkPort(this.dai.getInspectionOsIngressPortId(),
this.dai.getInspectionIngressMacAddress());
DefaultNetworkPort egressPort = new DefaultNetworkPort(this.dai.getInspectionOsEgressPortId(),
this.dai.getInspectionEgressMacAddress());
//Element object in DefaultInspectionPort is not used, hence null
controller.setInspectionHookFailurePolicy(new NetworkElementImpl(this.vmPort), new DefaultInspectionPort(ingressPort, egressPort, null),
FailurePolicyType.valueOf(this.securityGroupInterface.getFailurePolicyType().name()));
} finally {
controller.close();
}
}
DatabaseWrapper.java 文件源码
项目:SqlSauce
阅读 42
收藏 0
点赞 0
评论 0
/**
* @return The managed version of the provided entity (with set autogenerated values for example).
*/
@Nonnull
@CheckReturnValue
//returns a sauced entity
public <E extends SaucedEntity<I, E>, I extends Serializable> E merge(@Nonnull final E entity)
throws DatabaseException {
final EntityManager em = this.databaseConnection.getEntityManager();
try {
em.getTransaction().begin();
final E managedEntity = em.merge(entity);
em.getTransaction().commit();
return managedEntity
.setSauce(this);
} catch (final PersistenceException e) {
final String message = String.format("Failed to merge entity %s on DB %s",
entity.toString(), this.databaseConnection.getName());
throw new DatabaseException(message, e);
} finally {
em.close();
}
}
DefaultJpaDatastore.java 文件源码
项目:holon-datastore-jpa
阅读 37
收藏 0
点赞 0
评论 0
/**
* Set the entity id values of given <code>entity</code> instance to be returned as an {@link OperationResult}.
* @param result OperationResult in which to set the ids
* @param entityManager EntityManager
* @param set Entity bean property set
* @param entity Entity class
* @param instance Entity instance
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
private static void setInsertedIds(OperationResult.Builder result, EntityManager entityManager,
BeanPropertySet<Object> set, Class<?> entity, Object instance, boolean bringBackGeneratedIds,
PropertyBox propertyBox) {
try {
getIds(entityManager, set, entity).forEach(p -> {
Object keyValue = set.read(p, instance);
result.withInsertedKey(p, keyValue);
if (bringBackGeneratedIds && keyValue != null) {
// set in propertybox
Property property = getPropertyForPath(p, propertyBox);
if (property != null) {
propertyBox.setValue(property, keyValue);
}
}
});
} catch (Exception e) {
LOGGER.warn("Failed to obtain entity id(s) value", e);
}
}
DatabaseWrapper.java 文件源码
项目:SqlSauce
阅读 45
收藏 0
点赞 0
评论 0
public <E extends IEntity<I, E>, I extends Serializable> void deleteEntity(@Nonnull final EntityKey<I, E> entityKey)
throws DatabaseException {
final EntityManager em = this.databaseConnection.getEntityManager();
try {
em.getTransaction().begin();
final IEntity<I, E> entity = em.find(entityKey.clazz, entityKey.id);
if (entity != null) {
em.remove(entity);
}
em.getTransaction().commit();
} catch (final PersistenceException e) {
final String message = String.format("Failed to delete entity id %s of class %s on DB %s",
entityKey.id.toString(), entityKey.clazz.getName(), this.databaseConnection.getName());
throw new DatabaseException(message, e);
} finally {
em.close();
}
}
ListAlertService.java 文件源码
项目:osc-core
阅读 29
收藏 0
点赞 0
评论 0
@Override
public ListResponse<AlertDto> exec(BaseRequest<BaseDto> request, EntityManager em) throws Exception {
// Initializing Entity Manager
OSCEntityManager<Alert> emgr = new OSCEntityManager<Alert>(Alert.class, em, this.txBroadcastUtil);
List<AlertDto> alertList = new ArrayList<AlertDto>();
for (Alert alert : emgr.listAll(false, "createdTimestamp")) {
AlertDto dto = new AlertDto();
AlertEntityMgr.fromEntity(alert, dto);
alertList.add(dto);
}
ListResponse<AlertDto> response = new ListResponse<AlertDto>();
response.setList(alertList);
return response;
}
ConversationDataAccessObject.java 文件源码
项目:full-javaee-app
阅读 44
收藏 0
点赞 0
评论 0
public static boolean delete(int conversationID) {
if (conversationID > 0) {
EntityManager em = EMFUtil.getEMFactory().createEntityManager();
Conversations conversation = em.find(Conversations.class, conversationID);
if (conversation != null) {
EntityTransaction trans = em.getTransaction();
try {
trans.begin();
em.remove(conversation);
trans.commit();
return true;
} catch (Exception e) {
e.printStackTrace();
trans.rollback();
} finally {
em.close();
}
}
}
return false;
}
CheckK8sSecurityGroupLabelMetaTaskTestData.java 文件源码
项目:osc-core
阅读 40
收藏 0
点赞 0
评论 0
public static void persist(SecurityGroupMember sgm, EntityManager em) {
SecurityGroup sg = sgm.getSecurityGroup();
em.getTransaction().begin();
Set<VirtualSystem> virtualSystems = sg.getVirtualizationConnector().getVirtualSystems();
em.persist(sg.getVirtualizationConnector());
for (VirtualSystem vs : virtualSystems) {
em.persist(vs.getDomain().getApplianceManagerConnector());
em.persist(vs.getApplianceSoftwareVersion().getAppliance());
em.persist(vs.getApplianceSoftwareVersion());
em.persist(vs.getDistributedAppliance());
em.persist(vs.getDomain());
em.persist(vs);
}
em.persist(sgm.getLabel());
em.persist(sg);
em.persist(sgm);
em.getTransaction().commit();
}
OrderItemRepository.java 文件源码
项目:Pet-Supply-Store
阅读 32
收藏 0
点赞 0
评论 0
/**
* {@inheritDoc}
*/
@Override
public long createEntity(OrderItem entity) {
PersistenceOrderItem item = new PersistenceOrderItem();
item.setQuantity(entity.getQuantity());
item.setUnitPriceInCents(entity.getUnitPriceInCents());
EntityManager em = getEM();
try {
em.getTransaction().begin();
PersistenceProduct prod = em.find(PersistenceProduct.class, entity.getProductId());
PersistenceOrder order = em.find(PersistenceOrder.class, entity.getOrderId());
if (prod != null && order != null) {
item.setProduct(prod);
item.setOrder(order);
em.persist(item);
} else {
item.setId(-1L);
}
em.getTransaction().commit();
} finally {
em.close();
}
return item.getId();
}
ValidateSecurityGroupProjectTask.java 文件源码
项目:osc-core
阅读 37
收藏 0
点赞 0
评论 0
@Override
public void executeTransaction(EntityManager em) throws Exception {
OSCEntityManager<SecurityGroup> sgEmgr = new OSCEntityManager<SecurityGroup>(SecurityGroup.class, em, this.txBroadcastUtil);
this.securityGroup = sgEmgr.findByPrimaryKey(this.securityGroup.getId());
this.log.info("Validating the Security Group project " + this.securityGroup.getProjectName() + " exists.");
try (Openstack4jKeystone keystone = new Openstack4jKeystone(new Endpoint(this.securityGroup.getVirtualizationConnector()))) {
Project project = keystone.getProjectById(this.securityGroup.getProjectId());
if (project == null) {
this.log.info("Security Group project " + this.securityGroup.getProjectName() + " Deleted from openstack. Marking Security Group for deletion.");
// project was deleted, mark Security Group for deleting as well
OSCEntityManager.markDeleted(em, this.securityGroup, this.txBroadcastUtil);
} else {
// Sync the project name if needed
if (!project.getName().equals(this.securityGroup.getProjectName())) {
this.log.info("Security Group project name updated from " + this.securityGroup.getProjectName() + " to " + project.getName());
this.securityGroup.setProjectName(project.getName());
OSCEntityManager.update(em, this.securityGroup, this.txBroadcastUtil);
}
}
}
}
OsProjectNotificationListener.java 文件源码
项目:osc-core
阅读 29
收藏 0
点赞 0
评论 0
private void handleSGMessages(EntityManager em, String keyValue) throws Exception {
// if Project deleted belongs to a security group
for (SecurityGroup securityGroup : SecurityGroupEntityMgr.listByProjectId(em, keyValue)) {
// trigger sync job for that SG
if (securityGroup.getId().equals(((SecurityGroup) this.entity).getId())) {
this.sgConformJobFactory.startSecurityGroupConformanceJob(securityGroup);
}
}
}
ListSslCertificatesService.java 文件源码
项目:osc-core
阅读 43
收藏 0
点赞 0
评论 0
@Override
protected ListResponse<CertificateBasicInfoModel> exec(BaseRequest<BaseDto> request, EntityManager em) throws Exception {
List<CertificateBasicInfoModel> certificateInfoList = X509TrustManagerFactory.getInstance().getCertificateInfoList();
SslCertificateAttrEntityMgr sslCertificateAttrEntityMgr = new SslCertificateAttrEntityMgr(em, this.txBroadcastUtil);
List<SslCertificateAttrDto> sslEntriesList = sslCertificateAttrEntityMgr.getSslEntriesList();
for (CertificateBasicInfoModel cim : certificateInfoList) {
cim.setConnected(isConnected(sslEntriesList, cim.getAlias()));
}
return new ListResponse<>(certificateInfoList);
}
JpaEntityManagerRepository.java 文件源码
项目:bdf2
阅读 33
收藏 0
点赞 0
评论 0
public EntityManager getEntityManager(String dataSourceName){
if(dataSourceName==null){
return getEntityManager();
}else{
if(entityManagerMap.containsKey(dataSourceName)){
return entityManagerMap.get(dataSourceName);
}else{
return getEntityManager();
}
}
}
OriginalFileFillerTest.java 文件源码
项目:Mod-Tools
阅读 30
收藏 0
点赞 0
评论 0
/**
* Test of handle method, of class Task.
* @throws java.lang.Exception
* @deprecated has to be implemented on a case by case basis
*/
@Test
public void testHandle() throws Exception {
System.out.println("handle");
EntityManager manager = new PersistenceProvider().get();
manager.getTransaction().begin();
IOUtils.copyAndClose(
getClass().getResourceAsStream("/test.txt"),
FileUtils.openOutputStream(new File(getAllowedFolder()+"/steamapps/common/Stellaris/test.txt"))
);
Original original = new Original("test.txt");
manager.persist(original);
manager.getTransaction().commit();
List<ProcessTask> result = get(original.getAid()).handle(manager);
Assert.assertEquals(
"Follow-up number is wrong",
1,
result.size()
);
manager.getTransaction().begin();
manager.refresh(original);
Assert.assertTrue(
"Content was not written",
original.getContent().length() > 0
);
manager.getTransaction().commit();
}
JPACategoryService.java 文件源码
项目:BecomeJavaHero
阅读 36
收藏 0
点赞 0
评论 0
@Override
public List<Category> getAllCategories() {
EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("pl.edu.bogdan.training.db.entity");
EntityManager em = entityManagerFactory.createEntityManager();
// begining of transaction
em.getTransaction().begin();
Query query = em.createQuery("Select c from Category c");
return query.getResultList();
}
AddDistributedApplianceService.java 文件源码
项目:osc-core
阅读 37
收藏 0
点赞 0
评论 0
List<VirtualSystem> getVirtualSystems(EntityManager em, DistributedApplianceDto daDto, DistributedAppliance da) throws Exception {
List<VirtualSystem> vsList = new ArrayList<VirtualSystem>();
// build the list of associated VirtualSystems for this DA
Set<VirtualSystemDto> vsDtoList = daDto.getVirtualizationSystems();
for (VirtualSystemDto vsDto : vsDtoList) {
VirtualizationConnector vc = VirtualizationConnectorEntityMgr.findById(em, vsDto.getVcId());
// load the corresponding app sw version from db
ApplianceSoftwareVersion av = ApplianceSoftwareVersionEntityMgr.findByApplianceVersionVirtTypeAndVersion(em,
daDto.getApplianceId(), daDto.getApplianceSoftwareVersionName(), vc.getVirtualizationType(),
vc.getVirtualizationSoftwareVersion());
OSCEntityManager<Domain> oscEm = new OSCEntityManager<Domain>(Domain.class, em, this.txBroadcastUtil);
Domain domain = vsDto.getDomainId() == null ? null : oscEm.findByPrimaryKey(vsDto.getDomainId());
VirtualSystem vs = new VirtualSystem(da);
vs.setApplianceSoftwareVersion(av);
vs.setDomain(domain);
vs.setVirtualizationConnector(vc);
org.osc.sdk.controller.TagEncapsulationType encapsulationType = vsDto.getEncapsulationType();
if(encapsulationType != null) {
vs.setEncapsulationType(TagEncapsulationType.valueOf(
encapsulationType.name()));
}
// generate key store and persist it as byte array in db
vs.setKeyStore(PKIUtil.generateKeyStore());
vsList.add(vs);
}
return vsList;
}
ValidateDbCreate.java 文件源码
项目:osc-core
阅读 36
收藏 0
点赞 0
评论 0
private Domain addDomainEntity(EntityManager em, ApplianceManagerConnector applianceMgrCon) {
Domain domain = new Domain(applianceMgrCon);
domain.setName("DC-1");
domain.setMgrId("domain-id-3");
OSCEntityManager.create(em, domain, this.txBroadcastUtil);
// retrieve back and validate
domain = em.find(Domain.class, domain.getId());
assertNotNull(domain);
return domain;
}
Segnalazioni.java 文件源码
项目:corso-lutech
阅读 36
收藏 0
点赞 0
评论 0
@WebMethod
public List<Segnalazione> elencoSegnalazioni() {
EntityManager em = JPAConfig.getInstance().getEmf()
.createEntityManager();
return em.createQuery("select s from Segnalazione s", Segnalazione.class)
.getResultList();
}
GenericJpaRepositoryFactory.java 文件源码
项目:tasfe-framework
阅读 36
收藏 0
点赞 0
评论 0
public GenericJpaRepositoryFactory(EntityManager entityManager , SqlSessionTemplate sqlSessionTemplate) {
super(entityManager) ;
//设置当前类的实体管理器
this.entityManager = entityManager ;
//设置sqlSessionTemplate,线程安全
this.sqlSessionTemplate = sqlSessionTemplate ;
this.extractor = PersistenceProvider.fromEntityManager(entityManager);
}