本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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;
}