日期:2014-05-17 浏览次数:20651 次
public class HibernateBaseDao<E> extends HibernateDaoSupport implements GenericDao<E, Serializable> { private Class<E> entityClass; @Resource(name = "sessionFactory") public void setSuperSessionFactory(SessionFactory sessionFactory) { super.setSessionFactory(sessionFactory); } public HibernateBaseDao(Class<E> entityClass) { this.entityClass = entityClass; } }
<beans> <bean id="myTest" class="com.test.MyTest" > <!--构造函数方法注入--> <!--index:参数顺序 --> <constructor-arg index="0" type="java.lang.String"> <!--参数的值--> <value>sunDriver</value> </constructor-arg> <constructor-arg index="1" type="java.lang.String"> <value>jdbc:odbc:School</value> </constructor-arg> </bean> </beans>