Hi everyone
I have a question in implementing value list handler pattern.
is it better to implement the value list handler class as a stateful session bean or simple java class ? and why i should put session facade before my value list handler class ? [i'm using DataSource as my DAO and it supports caching ] [see http://java.sun.com/blueprints/corej2eepatterns/Patterns/index.html for more detail about my question]
I want to know what is the best way to implement a mechanism to execute select statements on database.
-
Value List Handler Pattern (4 messages)
- Posted by: Amir Hossein Hormati
- Posted on: September 24 2003 05:03 EDT
Threaded Messages (4)
- Value List Handler Pattern by Ian Mitchell on September 24 2003 11:52 EDT
- Stateful Session Bean + Value List Handler Pattern by Amit Gupta on September 24 2003 13:38 EDT
- my suggest by amon lei on September 24 2003 21:20 EDT
- My suggestions by Paul Strack on September 27 2003 15:33 EDT
-
Value List Handler Pattern[ Go to top ]
- Posted by: Ian Mitchell
- Posted on: September 24 2003 11:52 EDT
- in response to Amir Hossein Hormati
You generally need some way of managing conversational state in the handler. In an EJB architecture this would be an SFSB. In a web based architecture you could use a simple java class and keep the instance in the http session. -
Stateful Session Bean + Value List Handler Pattern[ Go to top ]
- Posted by: Amit Gupta
- Posted on: September 24 2003 13:38 EDT
- in response to Amir Hossein Hormati
I have a similar query. I have to show a report of all items (large resultset)for a specific category. There are around 15 categories in the database. If i implement Stateful Session Bean to store the Item List, the container will create a separate List for each client. Just imagine what will happens when 500 users are requesting the report.
Is it possible to cache the results in a centralized location which is accessible to all the users. In this case, at most 15 item list will be created irrespective of the number of users accessing it. -
my suggest[ Go to top ]
- Posted by: amon lei
- Posted on: September 24 2003 21:20 EDT
- in response to Amir Hossein Hormati
we using dao like this:
XXDAO
{
public ValueListHandler findXXByXXName(String XXName);
}
XXDAOimp implements XXDAO
{
public ValueListHandler findXXByXXName(String XXName)
{
..............//sql query and changethe resultset into TOs(Vector)
return new ValueListHandlerimp(TOs);
}
}
notice:
1. findXXByXXName is a finder method.
2. ValueListHandler is a interface ,ValueListHandlerimp is ValueListHandler 's implementer -
My suggestions[ Go to top ]
- Posted by: Paul Strack
- Posted on: September 27 2003 15:33 EDT
- in response to amon lei
1. Implement the DAO as a POJO, because then you can write and test it outside your EJB server (which makes testing ever so much easier).
2. If you want to do caching for your DAO, (a) consider switching to CMP (which will do caching) or (b) finding an ORM (Object-to-Relational-Mapping) tool that is EJB friendly and does caching, such as Hibernate. Caching logic gets very complicated very quickly, and there are plenty of tools out there that have already done it.