日期:2014-05-18 浏览次数:20837 次
public class BookDao extends HibernateDaoSupport {
private Session se;
public BookDao(){
se=this.getSession();
}
public void save(Book book) {
se.save(book);
}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'BookDao' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.gdpi.dao.BookDao]: Constructor threw exception; nested exception is java.lang.NullPointerException
<bean id="BookDao" class="com.gdpi.dao.BookDao">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
public class BookDao extends HibernateDaoSupport {
private Session se;
public void save(Book book) {
se=this.getSession();
se.save(book);
}