You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Raul Rosenzvaig <in...@limonn.com> on 2008/08/23 22:25:33 UTC

t5: DAO and hibernate integration

Does anyone have a working example of  Hibernate  in DAO service ?

Much appreciate

Raul Rosenzvaig 

-----
Raul Rosenzvaig
www.limonn.com
-- 
View this message in context: http://www.nabble.com/t5%3A-DAO-and-hibernate-integration-tp19124880p19124880.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: DAO and hibernate integration

Posted by Hugo Palma <hu...@gmail.com>.
Why don't you make those "normal java classes" services ?

shinkei wrote:
> Is there another way? 
>
> I have quite a few DAO's that need to talk with alot normal java classes
> behind the page. So it seems a bit messy injecting all the DAOs through the
> page class and then back into the java classes behind it.
>
>
>
>
> HugoPalma wrote:
>   
>> Just inject it into the page/component/service where the normal java 
>> class is being called from and pass the userDAO instance to it.
>>
>> shinkei wrote:
>>     
>>> 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 
>>>>>
>>>>>       
>>>>>           
>>>>     
>>>>         
>>>   
>>>       
>>     
>
>   

Re: t5: DAO and hibernate integration

Posted by shinkei <on...@hotmail.com>.

Is there another way? 

I have quite a few DAO's that need to talk with alot normal java classes
behind the page. So it seems a bit messy injecting all the DAOs through the
page class and then back into the java classes behind it.




HugoPalma wrote:
> 
> Just inject it into the page/component/service where the normal java 
> class is being called from and pass the userDAO instance to it.
> 
> shinkei wrote:
>> 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-tp19124880p19959177.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: DAO and hibernate integration

Posted by Hugo Palma <hu...@gmail.com>.
Just inject it into the page/component/service where the normal java 
class is being called from and pass the userDAO instance to it.

shinkei wrote:
> 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 
>>>
>>>       
>>     
>
>   

Re: t5: DAO and hibernate integration

Posted by shinkei <on...@hotmail.com>.

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: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: DAO and hibernate integration

Posted by Raul Rosenzvaig <in...@limonn.com>.
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 
> 


-----
Raul Rosenzvaig
www.limonn.com
-- 
View this message in context: http://www.nabble.com/t5%3A-DAO-and-hibernate-integration-tp19124880p19126302.html
Sent from the Tapestry - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: t5: DAO and hibernate integration

Posted by Sven Homburg <ho...@googlemail.com>.
http://www.chenillekit.org/chenillekit-hibernate/doa_sample.html

2008/8/23 Raul Rosenzvaig <in...@limonn.com>

>
> Does anyone have a working example of  Hibernate  in DAO service ?
>
> Much appreciate
>
> Raul Rosenzvaig
>
> -----
> Raul Rosenzvaig
> www.limonn.com
> --
> View this message in context:
> http://www.nabble.com/t5%3A-DAO-and-hibernate-integration-tp19124880p19124880.html
> Sent from the Tapestry - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
>
>


-- 
with regards
Sven Homburg
http://www.chenillekit.org
http://tapestry5-components.googlecode.com

Re: t5: DAO and hibernate integration

Posted by Shing Hing Man <ma...@yahoo.com>.
I have an example for Tap 5.0.13 and Tapetsry-Hibernate-5.0.13.  An online demo and source code are
at 

 http://lombok.demon.co.uk/folderTap5/


Shing


--- On Sun, 24/8/08, Raul Rosenzvaig <in...@limonn.com> wrote:

> From: Raul Rosenzvaig <in...@limonn.com>
> Subject: t5: DAO and hibernate integration
> To: users@tapestry.apache.org
> Date: Sunday, 24 August, 2008, 4:25 AM
> Does anyone have a working example of  Hibernate  in DAO
> service ?
> 
> Much appreciate
> 
> Raul Rosenzvaig 
> 
> -----
> Raul Rosenzvaig
> www.limonn.com
> -- 
> View this message in context:
> http://www.nabble.com/t5%3A-DAO-and-hibernate-integration-tp19124880p19124880.html
> Sent from the Tapestry - User mailing list archive at
> Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail:
> users-help@tapestry.apache.org

Send instant messages to your online friends http://uk.messenger.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org