How would I use the userDAO in a normal java class (ie. not a page)?

Inject won't seem to work unless its a page.

Can anyone help?



Raul Rosenzvaig wrote:
> 
> Finally I got the most simple solution from Onno
> 
> Just to pass the hibernate session in the constructor and that will do the
> trick:
> 
> import org.hibernate.Session;
> 
> public class UserDAOImpl implements UserDAO {
>    
>       private Session session;
>    
>    
>     public UserDAOImpl(Session session) {   //this is the constructor !!
>           this.session = session;
>     }
> 
> 
> after that I can inject the service and use it at my pages by:
> 
>             @Inject
>           private UserDAO userDAO;
> 
>               public List<User> getUserList()
>           {
>              
>                       return userDAO.findAllUsers();
> 
>             }
> 
> 
> 
> 
> Raul Rosenzvaig wrote:
>> 
>> Does anyone have a working example of  Hibernate  in DAO service ?
>> 
>> Much appreciate
>> 
>> Raul Rosenzvaig 
>> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/t5%3A-DAO-and-hibernate-integration-tp19124880p19958026.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