Quantcast

Living outside the RequestCycle: Three tier architectures

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Living outside the RequestCycle: Three tier architectures

mario.aixel
I have a question regarding the RequestCycle for Databinder and how it will fit a three-tier architecture model.

The main problem that I'm having is when I try to use a DAO. Initially I thought that the class Databinder could provide with the Session object from Hibernate. My understanding is that during each RequestCycle, Databinder controls the openning and closing of sessions. Thus, I thought that if I accessed the hibernate session from the static method of the Databinder class, I was then able to do all the queries and processing inside the request and delegate all the openning and closing to Databinder. Unfortunately, I'm getting null values for the session.

I have configured Hibernate so that will use the ManagedSessionContext class but the problem still persists.

I have the feeling that I have a problem of understanding of how the RequestCycle works. I have read several posting like this one or my favorite but some of the APIs have changed. So I am currently lost.

I wanted to build my architecture on top of Databinder Form objects because of its excellent transaction demarcation. Is there a way I can access the session, and do for example a business validation over a user in the data integration layer, and then return the value to the presentation layer (Databinder forms) without using Spring?

Thanks,
Mario
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Living outside the RequestCycle: Three tier architectures

mario.aixel
It turns out that my problem was already solved. In the case of a three tier architecture, I believe the best solution is to use the Spring/Hibernate (or similar) combination. It allows you to keep your data integration and business layer independent of the presentation. You can later on integrate the business layer with a web service, for example, and still use the same classes for your web app. That is the way to live outside the Request Cycle.

In either case you have the Databinder objects (HibernateObjectModel, DataForm) for presenting your data in a very elegant way.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Living outside the RequestCycle: Three tier architectures

n8han
Administrator
That's right, and I'm glad you like the DataForm and HibernateObjectModel scheme. There's some examples of the Databinder+Spring configuration in this article:
http://www.javaworld.com/javaworld/jw-09-2008/jw-09-wicket3.html

Nathan
Loading...