You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Werner Punz <we...@gmx.at> on 2004/12/30 23:18:20 UTC
Datascroller question again
Well, I posted the question a few days ago,
but back then the new list on Apache sort of was
empty, never got an answer. I try to post it again, now that the list
has picked up momentum.
I have following problem.
I want to have a Hibernate backed backend bean which I want
to connect to a datascroller/datatable combination.
The problem I see with the current API is, that it seems to be
either resultset, with a permanent open db connection and
plain jdbc, or load the entire resultset into the ram
and "shove" it into the datatable.
Now both combinations are not exactly what I want, I want
to have the connections not totally open all the time (the framework
will take care of it anyway once not used anymore)
and I want only the visible scope of database objects loaded.
My idea which I have been thinking about would be some kind of proxy
patterned list which is given to the datatable.
The list basically only loads one single page at a time and then closes
the connection but is giving the full size and keeping the page size for
the paging and the page pos.
(Even with the problem that this thing can be altered between
page requests during scroll operations by another user)
But my question is, am I correct with the assumption that writing a
proxy list is the cleanest way to reach my goals, or is there another
solution which might be cleaner and easier to implement (like an already
implemented solution which already does this or an existing hibernate
hook of the myfaces components in CVS?)
Werner
Re: Datascroller question again
Posted by cheeser <my...@cheeseronline.org>.
I'm using appfuse with jsf+hibernate+spring http://appfuse.dev.java.net
Werner Punz wrote:
> Thank you, I will look into this, that might be the best option.
> Btw. does anybody know if there already is a project
> which tries to marry JSF and Hibernate sort of?
>
> This combination looks to me like a really good one, with
> Hibernate objects being the data beans, a small framework doing the
> access control on top of hibernate as a backing bean
> and JSF controls, directly bound to the hibernate object as the frontend.
>
> (I am halfway there for an intranet project I am currently doing for my
> current employer)
>
>
> In combination with Spring this might be the best you can get currently.
>
> I don't like the plain JDBC route like Sun suggests particularily,
> especially due to the fact that they keep the connection open in their
> standard implementation, which is impossible on anything else than a
> site with a few users.
>
>
> Werner
>
>
> Travis Reeder wrote:
>
>> DataTable also can take a javax.faces.model.DataModel, so if you
>> create a DataModel, then you can control when and what to load on an
>> as needed basis.
>>
>> Travis
>
>
>
--
cheeser You can find my blog at http://cheeser.blog-city.com
Re: Datascroller question again
Posted by Werner Punz <we...@gmx.at>.
Thank you, I will look into this, that might be the best option.
Btw. does anybody know if there already is a project
which tries to marry JSF and Hibernate sort of?
This combination looks to me like a really good one, with
Hibernate objects being the data beans, a small framework doing the
access control on top of hibernate as a backing bean
and JSF controls, directly bound to the hibernate object as the frontend.
(I am halfway there for an intranet project I am currently doing for my
current employer)
In combination with Spring this might be the best you can get currently.
I don't like the plain JDBC route like Sun suggests particularily,
especially due to the fact that they keep the connection open in their
standard implementation, which is impossible on anything else than a
site with a few users.
Werner
Travis Reeder wrote:
> DataTable also can take a javax.faces.model.DataModel, so if you
> create a DataModel, then you can control when and what to load on an
> as needed basis.
>
> Travis
Re: Datascroller question again
Posted by Travis Reeder <tr...@ecommstats.com>.
DataTable also can take a javax.faces.model.DataModel, so if you create
a DataModel, then you can control when and what to load on an as needed
basis.
Travis
Werner Punz wrote:
> Well, I posted the question a few days ago,
> but back then the new list on Apache sort of was
> empty, never got an answer. I try to post it again, now that the list
> has picked up momentum.
>
> I have following problem.
> I want to have a Hibernate backed backend bean which I want
> to connect to a datascroller/datatable combination.
>
> The problem I see with the current API is, that it seems to be
> either resultset, with a permanent open db connection and
> plain jdbc, or load the entire resultset into the ram
> and "shove" it into the datatable.
>
> Now both combinations are not exactly what I want, I want
> to have the connections not totally open all the time (the framework
> will take care of it anyway once not used anymore)
> and I want only the visible scope of database objects loaded.
>
> My idea which I have been thinking about would be some kind of proxy
> patterned list which is given to the datatable.
> The list basically only loads one single page at a time and then
> closes the connection but is giving the full size and keeping the page
> size for the paging and the page pos.
> (Even with the problem that this thing can be altered between
> page requests during scroll operations by another user)
>
> But my question is, am I correct with the assumption that writing a
> proxy list is the cleanest way to reach my goals, or is there another
> solution which might be cleaner and easier to implement (like an
> already implemented solution which already does this or an existing
> hibernate hook of the myfaces components in CVS?)
>
> Werner
>
--
Travis Reeder
Ecommstats Web Analytics
www.ecommstats.com
Re: Datascroller question again
Posted by Werner Punz <we...@gmx.at>.
carsten@wildehor.de wrote:
>
> Hi. I am using Hibernate and MyFaces too. As data connections are a
> rare resource I try to use them as short as possible. So in the case
> of a data table I have a FactoryMethod like
> List getItems(String sortColum, boolean ascending);
> and
> List getItems(String sortColum, boolean ascending, Long pos, Long
> fetchsize);
> where I open the conection, retrieve the objects, close the connection
> and return the result. The tricky part is the caching. I am using
> different approaches as it realy depends on the data shown. For an
> user list shown as information for other customers it could be not
> important to see new users before a half hour, where you can use a
> asynchrounous cache were the update depends of time or is triggered by
> jms or similar. The bad thing about databases are the limited
> resources of connections. Once run out of connections your application
> will stale as most of the internet users will try to reload the page
> which leads to even more load on the database. On the opposite side,
> (a)synchronized caches can be a performance killer for the application
> servers. So choose your poison *g*
> I try to use no cache at all at the beginning of a project, but be
> prepared to activate different ones for different views/kind of
> objects. I would realy like to use a database cluster or even better a
> data grid, but this is way out of my budget:(
> The conclusion is: there is no 'one' solution to your problem. I would
> use the simplest and tune the application in a general way so you can
> react on the specific application behaviour. I am using aspectj to
> alter the caches so maybe i could you be from some help;)
>
Actually caching is a none issue, due to various reasons. Hibernate has
excellent caching itself, and the data operations
are basically performed on plain tables, so access should be fast anyway
(not too many users).
The connection problem indeed is there, but having used
hibernate already a few times, you have to jugde for yourself and keep
the connection time as low as possible, as you said.
The hibernate caching still works well in that case.
The main problem more that I was looking sort of for the best option to
marry hibernate with the datascroller (existing if possible) with the
least work possible. I got several hints and will check them out.
Re: Datascroller question again
Posted by ca...@wildehor.de.
Hi. I am using Hibernate and MyFaces too. As data connections are a rare
resource I try to use them as short as possible. So in the case of a data
table I have a FactoryMethod like
List getItems(String sortColum, boolean ascending);
and
List getItems(String sortColum, boolean ascending, Long pos, Long
fetchsize);
where I open the conection, retrieve the objects, close the connection and
return the result. The tricky part is the caching. I am using different
approaches as it realy depends on the data shown. For an user list shown
as information for other customers it could be not important to see new
users before a half hour, where you can use a asynchrounous cache were the
update depends of time or is triggered by jms or similar. The bad thing
about databases are the limited resources of connections. Once run out of
connections your application will stale as most of the internet users will
try to reload the page which leads to even more load on the database. On
the opposite side, (a)synchronized caches can be a performance killer for
the application servers. So choose your poison *g*
I try to use no cache at all at the beginning of a project, but be
prepared to activate different ones for different views/kind of objects. I
would realy like to use a database cluster or even better a data grid, but
this is way out of my budget:(
The conclusion is: there is no 'one' solution to your problem. I would use
the simplest and tune the application in a general way so you can react on
the specific application behaviour. I am using aspectj to alter the caches
so maybe i could you be from some help;)
Werner Punz <we...@gmx.at> wrote on 30.12.2004 23:18:20:
> Well, I posted the question a few days ago,
> but back then the new list on Apache sort of was
> empty, never got an answer. I try to post it again, now that the list
> has picked up momentum.
>
> I have following problem.
> I want to have a Hibernate backed backend bean which I want
> to connect to a datascroller/datatable combination.
>
> The problem I see with the current API is, that it seems to be
> either resultset, with a permanent open db connection and
> plain jdbc, or load the entire resultset into the ram
> and "shove" it into the datatable.
>
> Now both combinations are not exactly what I want, I want
> to have the connections not totally open all the time (the framework
> will take care of it anyway once not used anymore)
> and I want only the visible scope of database objects loaded.
>
> My idea which I have been thinking about would be some kind of proxy
> patterned list which is given to the datatable.
> The list basically only loads one single page at a time and then closes
> the connection but is giving the full size and keeping the page size for
> the paging and the page pos.
> (Even with the problem that this thing can be altered between
> page requests during scroll operations by another user)
>
> But my question is, am I correct with the assumption that writing a
> proxy list is the cleanest way to reach my goals, or is there another
> solution which might be cleaner and easier to implement (like an already
> implemented solution which already does this or an existing hibernate
> hook of the myfaces components in CVS?)
>
> Werner