struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alejandro <apar...@gmail.com>
Subject Re: struts2-fullhibernatecore-plugin-2.2.2-GA with struts2 and Hibernate
Date Fri, 14 Sep 2012 11:22:01 GMT
You must initializate session attribute.

2012/9/14 pirzada rashid <pirzada.rashid@gmail.com>

> Hi,
>
> I am using struts2-fullhibernatecore-plugin-2.2.2-GA in a demo strut2
> project with Hibernate. I tried my best but can not make it work. I am
> using all the latest jars.
>
> *Am I missing something?*
>
> Please help
>
> *ERROR LOG*
>
> 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
>
> *Library in my project*
>
> [image: enter image description here]
>
> *When I access page than get error*
>
> 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)......
>
> *My CustomerDAOImpl.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();
>     }
> }
>
> *EDITED ************
>
>  @SessionTarget
>         Session session;
>
>         @TransactionTarget
>         Transaction transaction;
>
> Problem is in the above code when Session and Transaction is injected. I am
> wondering that this might be problem of
> struts2-fullhibernatecore-plugin-2.2.2-GA not supporting
>
> hibernate-release-4.1.6.Final
> hibernate-validator-4.3.0.Final
>
> because plugin site
> http://code.google.com/p/full-hibernate-plugin-for-struts2/ mentioned that
> only supported versions are
>
> *This plugin is compatible with Hibernate Validator 3.1.0 and 4.0.2 (since
> 2.2 version)*.
>
> *Is that the problem. Have anyone used this plugin with above mentioned
> versions?*
>
> *One more question: Can we use this plugin in the production environment?*
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message