当前位置: 首页>>代码示例>>Java>>正文


Java DataAccessException类代码示例

本文整理汇总了Java中com.holonplatform.core.exceptions.DataAccessException的典型用法代码示例。如果您正苦于以下问题:Java DataAccessException类的具体用法?Java DataAccessException怎么用?Java DataAccessException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataAccessException类属于com.holonplatform.core.exceptions包,在下文中一共展示了DataAccessException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: load

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public Stream<PropertyBox> load(QueryConfigurationProvider configuration, int offset, int limit)
		throws DataAccessException {
	Query q = datastore.query().target(TARGET);

	if (configuration.getQueryFilter() != null) {
		q.filter(configuration.getQueryFilter());
	}
	if (configuration.getQuerySort() != null) {
		q.sort(configuration.getQuerySort());
	}
	if (limit > 0) {
		q.limit(limit);
		q.offset(offset);
	}

	return q.stream(TestData.PROPERTIES);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:19,代码来源:TestPropertyQueryContainer.java

示例2: withEntityManager

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public <R> R withEntityManager(EntityManagerOperation<R> operation) {
	ObjectUtils.argumentNotNull(operation, "Operation must be not null");

	// initialize
	final EntityManager entityManager = getEntityManager();
	if (entityManager == null) {
		throw new IllegalStateException(
				"Obtained a null EntityManager from initializer [" + getEntityManagerInitializer() + "]");
	}
	try {
		// execute operation
		return operation.execute(entityManager);
	} catch (Exception e) {
		throw new DataAccessException("Failed to execute operation", e);
	} finally {
		getEntityManagerFinalizer().ifPresent(f -> f.finalizeEntityManager(entityManager));
	}
}
 
开发者ID:holon-platform,项目名称:holon-datastore-jpa,代码行数:20,代码来源:DefaultJpaDatastore.java

示例3: load

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public Stream<PropertyBox> load(QueryConfigurationProvider configuration, int offset, int limit)
		throws DataAccessException {
	Query q = buildQuery(configuration, true);
	// paging
	if (limit > 0) {
		q.limit(limit);
		q.offset(offset);
	}
	// execute
	Stream<PropertyBox> results = q.stream(propertySet);
	if (getItemIdentifier().isPresent()) {
		return results.map(pb -> new IdentifiablePropertyBox(pb, getItemIdentifier().get()));
	}
	return results;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin,代码行数:17,代码来源:DatastoreItemDataProvider.java

示例4: size

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public long size(QueryConfigurationProvider configuration) throws DataAccessException {
	try {
		return buildQuery(configuration, false).count();
	} catch (Exception e) {
		throw new DataAccessException(e);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:DatastoreItemDataProvider.java

示例5: load

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public Stream<PropertyBox> load(QueryConfigurationProvider configuration, int offset, int limit)
		throws DataAccessException {
	Query q = buildQuery(configuration, true);
	// paging
	if (limit > 0) {
		q.limit(limit);
		q.offset(offset);
	}
	// execute
	return q.stream(propertySet);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:13,代码来源:DatastoreItemDataProvider.java

示例6: refresh

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public ITEM refresh(ITEM item) throws UnsupportedOperationException, DataAccessException {
	if (refresher == null) {
		throw new UnsupportedOperationException();
	}
	return refresher.refresh(item);
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:8,代码来源:DefaultItemDataProvider.java

示例7: refresh

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public Item refresh(Item item) throws UnsupportedOperationException, DataAccessException {
	ITEM itm = provider.refresh(adapter.restore(configuration, item));
	if (itm != null) {
		return adapter.adapt(configuration, itm);
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:ContainerItemDataProvider.java

示例8: getItemId

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public ID getItemId(PropertyBox item) {
	if (item != null) {
		return item.getValueIfPresent(identifierProperty)
				.orElseThrow(() -> new DataAccessException("The identifier property [" + identifierProperty
						+ "] is not present in PropertyBox item [" + item + "]"));
	}
	return null;
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:10,代码来源:PropertyItemIdentifier.java

示例9: size

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public long size(QueryConfigurationProvider configuration) throws DataAccessException {
	StringBuilder sb = new StringBuilder();
	sb.append("select count(*) from testdata");
	setupQuery(configuration, sb, false);

	try (Connection connection = getConnection();
			Statement stmt = connection.createStatement();
			ResultSet rs = stmt.executeQuery(sb.toString())) {
		rs.next();
		return rs.getLong(1);
	} catch (SQLException e) {
		throw new DataAccessException(e);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:16,代码来源:TestItemQueryContainer.java

示例10: load

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public Stream<TestDataDomain> load(QueryConfigurationProvider configuration, int offset, int limit)
		throws DataAccessException {
	StringBuilder sb = new StringBuilder();
	sb.append("select * from testdata");
	setupQuery(configuration, sb, true);

	if (limit > 0) {
		sb.append(" limit ");
		sb.append(limit);
		sb.append(" offset ");
		sb.append(offset);
	}

	List<TestDataDomain> items = new ArrayList<>();

	try (Connection connection = getConnection();
			Statement stmt = connection.createStatement();
			ResultSet rs = stmt.executeQuery(sb.toString())) {

		while (rs.next()) {
			TestDataDomain d = new TestDataDomain();
			d.setCode(rs.getString("code"));
			d.setDescription(rs.getString("description"));
			d.setSequence(rs.getInt("sequence"));
			d.setObsolete(rs.getInt("obsolete"));
			items.add(d);
		}

	} catch (SQLException e) {
		throw new DataAccessException(e);
	}

	return items.stream();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:36,代码来源:TestItemQueryContainer.java

示例11: getConnection

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
private Connection getConnection() throws DataAccessException {
	try {
		return DriverManager.getConnection("jdbc:h2:mem:testdb1;INIT=RUNSCRIPT FROM 'classpath:test-db.sql'",
				"sa", "");
	} catch (SQLException e) {
		throw new DataAccessException(e);
	}
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:TestItemQueryContainer.java

示例12: size

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public long size(QueryConfigurationProvider configuration) throws DataAccessException {
	Query q = datastore.query().target(TARGET);
	if (configuration.getQueryFilter() != null) {
		q.filter(configuration.getQueryFilter());
	}
	return q.count();
}
 
开发者ID:holon-platform,项目名称:holon-vaadin7,代码行数:9,代码来源:TestPropertyQueryContainer.java

示例13: load

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@OnShow
public void load() {
	// if id parameter is not null, we are in edit mode
	if (id != null) {
		// load the product data
		form.setValue(datastore.query().target(TARGET).filter(ID.eq(id)).findOne(PRODUCT)
				// throw an exception if a product with given id was not found
				.orElseThrow(() -> new DataAccessException("Data not found: " + id)));
	}
	// enable the Clear button if not in edit mode
	clearButton.setVisible(id == null);
}
 
开发者ID:holon-platform,项目名称:holon-examples,代码行数:13,代码来源:Manage.java

示例14: onShow

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@OnShow
public void onShow() {
	// set the view form product value
	viewForm.setValue(
			// load product using id parameter
			datastore.query().target(TARGET).filter(ID.eq(id)).findOne(PRODUCT)
					// throw an exception if not found
					.orElseThrow(() -> new DataAccessException("Product not found: " + id)));
}
 
开发者ID:holon-platform,项目名称:holon-examples,代码行数:10,代码来源:View.java

示例15: enter

import com.holonplatform.core.exceptions.DataAccessException; //导入依赖的package包/类
@Override
public void enter(ViewChangeEvent event) {
	// if id parameter is not null, we are in edit mode
	if (id != null) {
		// load the product data
		form.setValue(datastore.query().target(DataTarget.named("products")).filter(MProduct.ID.eq(id))
				.findOne(MProduct.PRODUCT)
				// throw an exception if a product with given id was not found
				.orElseThrow(() -> new DataAccessException("Data not found: " + id)));
	}
}
 
开发者ID:holon-platform,项目名称:holon-examples,代码行数:12,代码来源:Manage.java


注:本文中的com.holonplatform.core.exceptions.DataAccessException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。