當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。