本文整理汇总了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;
}