我在带有 Hibernate 的演示 strut2 项目中使用 struts2-fullhibernatecore-plugin-2.2.2-GA。我尽力而为,但无法使其发挥作用。我正在使用所有最新的罐子。
我错过了什么吗?
请帮忙
错误日志
2012-09-14 02:06:50 - [  INFO - SessionTransactionInjectorInterceptor:41 ] --> Full Hibernate Plugin Validation could not detect Hibernate Validator 3.x
2012-09-14 02:06:50 - [  INFO - SessionTransactionInjectorInterceptor:46 ] --> Full Hibernate Plugin Validation using Hibernate Validator 4.x
我项目中的图书馆

当我访问页面时出现错误
java.lang.NullPointerException
    com.myapp.dao.CustomerDAOImpl.listCustomer(CustomerDAOImpl.java:26)
    com.myapp.web.CustomerAction.listCustomer(CustomerAction.java:47)
    sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    java.lang.reflect.Method.invoke(Method.java:597)
    com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:453)......
我的客户DAOImpl.java
package com.myapp.dao;
import com.googlecode.s2hibernate.struts2.plugin.annotations.SessionTarget;
import com.googlecode.s2hibernate.struts2.plugin.annotations.TransactionTarget;
import com.myapp.model.Customer;
import org.hibernate.Session;
import org.hibernate.Transaction;
import java.util.List;
public class CustomerDAOImpl implements CustomerDAO {
    @SessionTarget
    Session session;
    @TransactionTarget
    Transaction transaction;
    //add the customer
    public void addCustomer(Customer customer) {
        session.save(customer);
    }
    //return all the customers in list
    public List<Customer> listCustomer() {
        return session.createQuery("from Customer").list();
    }
}
**已编辑 *********************
 @SessionTarget
        Session session;
        @TransactionTarget
        Transaction transaction;
当注入 Session 和 Transaction 时,问题出在上面的代码中。我想知道这可能是 struts2-fullhibernatecore-plugin-2.2.2-GA 不支持的问题
hibernate-release-4.1.6.Final
hibernate-validator-4.3.0.Final
因为插件网站http://code.google.com/p/full-hibernate-plugin-for-struts2/提到只有支持的版本是
这个插件兼容 Hibernate Validator 3.1.0 和 4.0.2(从 2.2 版本开始)。
是不是这个问题。有没有人在上面提到的版本中使用过这个插件?
还有一个问题:我们可以在生产环境中使用这个插件吗?