Re: T5 + Jetty + Hibernate
On 2/26/07, James Carman <[EMAIL PROTECTED]> wrote: 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). Well as i said this is a starting point a complete solution, this show how fine is to develop with T5 IoC. You're welcome to elaborate and improve. -- Massimo http://meridio.blogspot.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: T5 + Jetty + Hibernate
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" To: "Tapestry users" Subject: Re: T5 + Jetty + HibernateDate: 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]
Re: T5 + Jetty + Hibernate
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]
Re: T5 + Jetty + Hibernate
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]
T5 + Jetty + Hibernate
Hi, Does anyone has an example of how to get tapestry, jetty and hibernate running together? The internet is lacking in documentation about this. I have a book with an example for T4 and Tomcat and that helped me in getting a normal DataSource functioning with JettyPlus but I am not able to get hibernate working. The example in T4 also uses @InjectObject but that is not available in T5. So what do I think I need? - How to implement the service. - How to define it in jettyplus.xml. - How to access the service from within Tapestry. Ah, and I'm using Jetty5 + JettyPlus. If one of you has some code that does this just sending the code without any explanation would already be a step forward for me! Thanks in advance. Olivier - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]