Hi guys !

I m trying to expand one of the main tutorials 
http://www.infoq.com/articles/tapestry5-intro Tapestry for Nonbelievers 
bringing data from database through hibernate.

import org.apache.tapestry5.ioc.annotations.Inject;
import org.apache.tapestry5.tutorial.entities.User;
import org.apache.tapestry5.tutorial.services.UserDAO;
import org.hibernate.Session;


If I do at the start  class

            @Inject
            private Session session;

public List<User> getUserList()
            {
              return session.createCriteria(User.class).list();
            }

Works OK !!

but if I use the same at 

public class UserDAOImpl implements UserDAO {

    @Inject
    private Session session;  // Why  this is null ???????????
        
        
        public UserDAOImpl(){
                
        }
        
        public List<User> findAllUsers()
        {
           return session.createCriteria(User.class).list();
        }

I get a null pointer exception at session because is null

Why session is null with the same inject annotation here and not there

then at the start class I wanted to do :

            @Inject
            private UserDAO userDAO;

                public List<User> getUserList()
            {
               return userDAO.findAllUsers();
           }

but null pointer exception at UserDAOImpl

-----
Raul Rosenzvaig
www.limonn.com
-- 
View this message in context: 
http://www.nabble.com/inyect-Session-not-working-for-hibernate-tp19122647p19122647.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to