10.2. 一致的异常层次
Spring提供了一种方便的方法,把特定于某种技术的异常,如SQLException, 转化为自己的异常,这种异常属于以DataAccessException 为根的异常层次。这些异常封装了原始异常对象,这样就不会有丢失任何错误信息的风险。
除了对JDBC异常的封装,Spring也对Hibernate异常进行了封装,把它们从一种专有的checked异常 (Hibernate3.0以前的版本),转化为一系列抽象的运行时异常。对JDO也是这样。 它可以让你轻松处理大多数持久化异常(这些异常大多是不可恢复的,而且只出现在特定 的层次),而不再需要在DAO中编写讨厌的样板式的catch/throw代码块和异常声明。
9.1.2 Spring AOP capabilities and goals
Spring AOP currently supports only method execution join points (advising the execution of methods on Spring beans). Field interception is not implemented, although support for field interception could be added without breaking the core Spring AOP APIs. If you need to advise field access and update join points, consider a language such as AspectJ .
spring对Hibernate的支持,主要是通过 HibernateTemplate 和
HibernateDaoSupport,
让我们自己写的dao类继承 HibernateDaoSupport,从而获得
HibernateTemplate 这个对象