This week's book giveaway is in the Other Languages forum. We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line! See this thread for details.
I'm developing a web project in JSP which uses Hibernate to cache and edit data records. The user just sees one record including all its lines on a page - if he wants to see another record the page is reloaded. Every record contains a list of 1-7 lines of data from a(n updateable) view which needs to be changed sometimes. Now it comes to the point where I have to design the efficiency of the whole thing. I guess I have three (four?) options:
1. Load the whole data in the beginning and just perform list.add/deletes as something occurs. Here would the question be how the data is loaded in this moment. Just by using session.createQuery( "Select E From Elements E") it's not really queued. Also I am a bit afraid of potential timeouts. I am using c3p0 and as a timeout occurs it can handle it (even though it takes ~30s until the successful reconnect...)
2. The other option would be to load and change everything on demand and use HQL to catch the Item of desire in the moment the user changes/inserts a record:
Here I guess I'd lose some time while the loading of the current page. (The view eats some ressources) but win time due to the efficiency of HQL (or am I wrong?).
3. A mixed solution of both. All the records have to be loaded into the cache in the beginning (again the question as mentioned above how they are really loaded - including the @OneToMany-Lists of its records) and the update is done with the HQL statement.