ssh整合会话工厂获得
在applicationContext.xml文件中配置了事务管理器
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<tx:annotation-driven transaction-manager="txManager"/>
public class EmployeeService implements EmployeeServiceInter {
@Transactional
public void addEmployee(Employee e) {
// TODO Auto-generated method stub
sessionFactory.getCurrentSession().save(e);
}
}
怎么能方便的得到会话工厂呢?ssh java bean class string
public class LoginAction extends ActionSupport {
private EmployeeServiceInter employeeServiceInter;
/**
* @return
*/
public String execute() {
employeeServiceInter.addEmployee(employee);
}
public void setEmployeeServiceInter(EmployeeServiceInter employeeServiceInter) {
this.employeeServiceInter = employeeServiceInter;
}