protected EntitySqlDaoTransactionWrapper<M> getCreateEntitySqlDaoTransactionWrapper(final M entity, final InternalCallContext context) { final EntitySqlDaoTransactionWrapper<List<M>> entityWrapperList = getCreateEntitySqlDaoTransactionWrapper(ImmutableList.<M>of(entity), context); return new EntitySqlDaoTransactionWrapper<M>() { @Override public M inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception { final List<M> result = entityWrapperList.inTransaction(entitySqlDaoWrapperFactory); return result.isEmpty() ? null : result.get(0); } }; }
public void create(final Iterable<M> entities, final InternalCallContext context) throws U { final List<M> refreshedEntities = transactionalSqlDao.execute(false, targetExceptionClass, getCreateEntitySqlDaoTransactionWrapper(entities, context)); // Populate the caches only after the transaction has been committed, in case of rollbacks for (M refreshedEntity : refreshedEntities) { transactionalSqlDao.populateCaches(refreshedEntity); } }
@Override public void create(final M entity, final InternalCallContext context) throws U { final M refreshedEntity = transactionalSqlDao.execute(false, targetExceptionClass, getCreateEntitySqlDaoTransactionWrapper(entity, context)); // Populate the caches only after the transaction has been committed, in case of rollbacks transactionalSqlDao.populateCaches(refreshedEntity); }
protected EntitySqlDaoTransactionWrapper<M> getCreateEntitySqlDaoTransactionWrapper(final M entity, final InternalCallContext context) { final EntitySqlDaoTransactionWrapper<List<M>> entityWrapperList = getCreateEntitySqlDaoTransactionWrapper(ImmutableList.<M>of(entity), context); return new EntitySqlDaoTransactionWrapper<M>() { @Override public M inTransaction(final EntitySqlDaoWrapperFactory entitySqlDaoWrapperFactory) throws Exception { final List<M> result = entityWrapperList.inTransaction(entitySqlDaoWrapperFactory); return result.isEmpty() ? null : result.get(0); } }; }
public void create(final Iterable<M> entities, final InternalCallContext context) throws U { final List<M> refreshedEntities = transactionalSqlDao.execute(false, targetExceptionClass, getCreateEntitySqlDaoTransactionWrapper(entities, context)); // Populate the caches only after the transaction has been committed, in case of rollbacks for (M refreshedEntity : refreshedEntities) { transactionalSqlDao.populateCaches(refreshedEntity); } }
@Override public void create(final M entity, final InternalCallContext context) throws U { final M refreshedEntity = transactionalSqlDao.execute(false, targetExceptionClass, getCreateEntitySqlDaoTransactionWrapper(entity, context)); // Populate the caches only after the transaction has been committed, in case of rollbacks transactionalSqlDao.populateCaches(refreshedEntity); }