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


Java DataAccessException.printStackTrace方法代码示例

本文整理汇总了Java中org.springframework.dao.DataAccessException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java DataAccessException.printStackTrace方法的具体用法?Java DataAccessException.printStackTrace怎么用?Java DataAccessException.printStackTrace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.dao.DataAccessException的用法示例。


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

示例1: addBook

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
@Override
public int addBook(Book book) {
	// TODO Auto-generated method stub

	Session session = sessionFactory.openSession();
	Transaction transaction = session.beginTransaction();
	try {
		session.saveOrUpdate(book);
		transaction.commit();
		session.close();
		return 1;
	} catch (DataAccessException exception) {
		exception.printStackTrace();
	}
	return 0;

}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:18,代码来源:BookDAO_SessionFactory.java

示例2: updateBook

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
@Override
public int updateBook(long ISBN, int price) {
	// TODO Auto-generated method stub

	Session session = sessionFactory.openSession();
	Transaction transaction = session.beginTransaction();
	try {
		Book book = session.get(Book.class, ISBN);
		book.setPrice(price);

		session.saveOrUpdate(book);
		transaction.commit();
		session.close();
		return 1;
	} catch (DataAccessException exception) {
		exception.printStackTrace();
	}
	return 0;

}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:21,代码来源:BookDAO_SessionFactory.java

示例3: deleteBook

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
@Override
public boolean deleteBook(long ISBN) {
	// TODO Auto-generated method stub
	Session session = sessionFactory.openSession();
	Transaction transaction = session.beginTransaction();
	try {
		Book book = session.get(Book.class, ISBN);
		session.delete(book);
		transaction.commit();
		session.close();
		return true;
	} catch (DataAccessException exception) {
		exception.printStackTrace();
	}
	return false;
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:17,代码来源:BookDAO_SessionFactory.java

示例4: deleteBook

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
@Override
public boolean deleteBook(long ISBN) {
	// TODO Auto-generated method stub
	Session session = sessionFactory.openSession();
	Transaction transaction = session.beginTransaction();
	try {
		Book book = session.get(Book.class, ISBN);
		session.delete(book);
		transaction.commit();
		session.close();
		return true;
	} catch (DataAccessException exception) {
		exception.printStackTrace();
	}
	return false;

}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:18,代码来源:BookDAO_SessionFactory_Cache.java

示例5: getBook

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
@Override
@Cacheable("repo")
public Book getBook(long ISBN) {
	// TODO Auto-generated method stub
	Session session = sessionFactory.openSession();
	Transaction transaction = session.beginTransaction();
	Book book = null;
	try {
		book = session.get(Book.class, ISBN);
		transaction.commit();
		session.close();
	} catch (DataAccessException exception) {
		exception.printStackTrace();
	}
	return book;
}
 
开发者ID:PacktPublishing,项目名称:Learning-Spring-5.0,代码行数:17,代码来源:BookDAO_SessionFactory_Cache.java

示例6: readCallBackUrlByClientId

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
public List<Map<String, String>> readCallBackUrlByClientId(Set<String> clientIds) {
       try {
       	String parameterIds = "'" + Joiner.on("','").join(clientIds) + "'";
		return jdbcTemplate.query(CALLBACK_URL_CLIENT_ID_SELECT_STATEMENT + "(" + parameterIds + ")",new RowMapper<Map<String, String>>(){  
		    
		    @Override  
		    public Map<String, String> mapRow(ResultSet rs, int rowNum) throws SQLException {  
		        return ImmutableMap.of("clientId",rs.getString("client_id"),"callbackUrl",rs.getString("callback_url"),"clientSecret",rs.getString("client_secret"));
		    }  
		});
	} catch (DataAccessException e) {
		e.printStackTrace();
	}
       
       return Collections.emptyList();
}
 
开发者ID:xienjiang,项目名称:session-cloud,代码行数:17,代码来源:CustomTokenStore.java

示例7: readCallBackUrl

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
public String readCallBackUrl(final String clientId) {
	try {
		return jdbcTemplate.queryForObject(CALLBACK_URL_SELECT_STATEMENT, new Object[]{clientId},String.class);
	} catch (DataAccessException e) {
		e.printStackTrace();
	}
	
	return StringUtils.EMPTY;
}
 
开发者ID:xienjiang,项目名称:session-cloud,代码行数:10,代码来源:CustomTokenStore.java

示例8: setSubscribeUrl

import org.springframework.dao.DataAccessException; //导入方法依赖的package包/类
public boolean setSubscribeUrl(final String clientId, final String callbackUrl) {
	try {
		int updateN = jdbcTemplate.update(CALLBACK_URL_UPDATE_STATEMENT, new Object[]{callbackUrl,clientId});
		return updateN == NumberUtils.INTEGER_ONE;
	} catch (DataAccessException e) {
		e.printStackTrace();
	}
	return false;
}
 
开发者ID:xienjiang,项目名称:session-cloud,代码行数:10,代码来源:CustomTokenStore.java


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