don't send email to me again and again! I unsubscribe from tapestry.org ,but I remain receive one  hundred emails even more  from tapestry!




离人网

From: "James Carman" <[EMAIL PROTECTED]>
Reply-To: "Tapestry users" <users@tapestry.apache.org>
To: "Tapestry users" <users@tapestry.apache.org>
Subject: Re: T5 + Jetty + Hibernate
Date: Mon, 26 Feb 2007 06:32:57 -0500
>That's not exactly a good separation of concerns, though. Your view
>layer shouldn't be talking directly to your ORM layer. I'd put a
>DAO
>layer in between for some encapsulation (and to help with unit
>testing).
>
>
>On 2/26/07, Massimo Lusetti <[EMAIL PROTECTED]> wrote:
>>On 2/25/07, Olivier Jacquet <[EMAIL PROTECTED]> wrote:
>>
>> >
>> > Hi,
>> >
>> >
>> > Does anyone has an example of how to get tapestry, jetty and
>>hibernate
>> > running together?
>>
>>Having an hibernate Session injected into T5 pages is fairly easy:
>>
>>public final static SessionFactory buildSessionFactory()
>> {
>> URL res =
>>AppModule.class.getResource("/hibernate.cfg.xml");
>> SessionFactory sf = new AnnotationConfiguration()
>> .configure(res)
>> .buildSessionFactory();
>>
>> return sf;
>> }
>>
>>
>> @Lifecycle("perthread")
>> public Session buildSession(@InjectService("SessionFactory")
>> SessionFactory factory)
>> {
>> return factory.getCurrentSession();
>>// return factory.openSession();
>> }
>>
>>
>>Then in you page just:
>>
>> @Inject
>> private Session _session;
>>
>>I think all of these is explained in the online doc.
>>
>>If you need/wish more integration (like having your hibernate
>>object
>>directly into your pages) you have to do some more work, this is
>>just
>>a starting point.
>>
>>--
>>Massimo
>>http://meridio.blogspot.com
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>


请使用 MSN Messenger 与联机的朋友进行交流 --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to