javax.persistence.EntityManager.refresh()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(310)

本文整理了Java中javax.persistence.EntityManager.refresh()方法的一些代码示例,展示了EntityManager.refresh()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。EntityManager.refresh()方法的具体详情如下:
包路径:javax.persistence.EntityManager
类名称:EntityManager
方法名:refresh

EntityManager.refresh介绍

[英]Refresh the state of the instance from the database, overwriting changes made to the entity, if any.
[中]从数据库刷新实例的状态,覆盖对实体所做的更改(如果有)。

代码示例

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public void refresh(Order order) {
  if (order != null && !(order instanceof NullOrderImpl)) {
    em.refresh(order);
  }
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity, Map<String, Object> properties) {
  em.refresh(entity, properties);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity) {
  em.refresh(entity);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity, LockModeType lockMode) {
  em.refresh(entity, lockMode);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties) {
  em.refresh(entity, lockMode, properties);
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public void refresh(Serializable entity) {
  standardEntityManager.refresh(entity);
}

代码示例来源:origin: rapidoid/rapidoid

public void refresh(final Object entity) {
  em.refresh(entity);
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public AdminSection save(AdminSection adminSection) {
  adminSection = em.merge(adminSection);
  AdminModule module = adminSection.getModule();
  em.refresh(module);
  return adminSection;
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public void remove(AdminSection adminSection) {
  AdminModule module = adminSection.getModule();
  em.remove(adminSection);
  em.refresh(module);
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
@Transactional("blTransactionManager")
public Order readOrderById(final Long orderId, boolean refresh) {
  Order order = readOrderById(orderId);
  if (refresh) {
    em.refresh(order);
  }
  return order;
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity, LockModeType lockMode) {
  em().refresh(entity, lockMode);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity) {
  em().refresh(entity);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity, Map<String, Object> properties) {
  em().refresh(entity, properties);
}

代码示例来源:origin: rapidoid/rapidoid

@Override
public void refresh(Object entity, LockModeType lockMode, Map<String, Object> properties) {
  em().refresh(entity, lockMode, properties);
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public Entity fetchEntityBasedOnId(String structuredContentId, List<String> dirtyFields) throws Exception {
  StructuredContent structuredContent = structuredContentService.findStructuredContentById(Long.valueOf(structuredContentId));
  //Make sure the fieldmap is refreshed from the database based on any changes introduced in addOrUpdate()
  em.refresh(structuredContent);
  return fetchDynamicEntity(structuredContent, dirtyFields, true);
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public Entity fetchEntityBasedOnId(String pageId, List<String> dirtyFields) throws Exception {
  Page page = pageService.findPageById(Long.valueOf(pageId));
  //Make sure the fieldmap is refreshed from the database based on any changes introduced in addOrUpdate()
  em.refresh(page);
  return fetchDynamicEntity(page, dirtyFields, true);
}

代码示例来源:origin: spring-projects/spring-framework

@Test(expected = TransactionRequiredException.class)
public void transactionRequiredExceptionOnRefresh() {
  EntityManagerFactory emf = mock(EntityManagerFactory.class);
  EntityManager em = SharedEntityManagerCreator.createSharedEntityManager(emf);
  em.refresh(new Object());
}

代码示例来源:origin: BroadleafCommerce/BroadleafCommerce

@Override
public void execute() {
  for (OfferCode offerCode : orderOfferCodes) {
    if (offerCode.getOffer() != null) {
      Long sandBoxVersionId = sandBoxHelper.getSandBoxVersionId(OfferImpl.class, offerCode.getOffer().getId());
      if (sandBoxVersionId != null && !Objects.equals(sandBoxVersionId, offerCode.getOffer().getId())) {
        em.refresh(offerCode);
      }
    }
  }
}

代码示例来源:origin: hibernate/hibernate-orm

em.refresh( entity );
em.remove( entity );
em.getTransaction().commit();

代码示例来源:origin: hibernate/hibernate-orm

phone.setNumber( "987-654-3210" );
entityManager.refresh( person );

相关文章