I don't know if there is a way to do this in orion.

However I solved it using a simple class to represent a row in the database.
For instance :

ID TEXT in database would render the class

public class MyText {
    private String id = null;
    private String text = null;
    public MyText(String  id, String text) {
        //instantiate
        this.id = id;
        this.text = text;
    }
    //getter and setter methods.
}

An instance of this class would I store in a Hashtable with the primary key
as key. All interaction reading from database where types are Numeric or
whatever I'd use the getString("id"), since I only use this for View.

The cache itself I'd use the singleton pattern or scope application.

Init of cache I do in a servlet which is loaded on startup <LOAD ON
STARTUP>1</L...>

Some of the things that frequently are done are the <option value="1">text,
and those I set when reading the database using a static field in MyText,
using StringBuffer when loading for performance.

    private static String options;
    public static void setOptions(String text){}
    public static String getOptions() {}

This makes it very easy to write an options box at a jsp page or from a
servlet, just use :

<select name="text">
    <%=MyText.getOptions()%>
</select>

Simple...


Ok, this was a cachereflection written a monday morning, tired and
overworked. So please excuse my lack of imagination and spelling skills.

It would be interesting to start a thread regarding cache methods!

regards



Johan Fredriksson
----- Original Message -----
From: "Neal Kaiser" <[EMAIL PROTECTED]>
To: "Orion-Interest" <[EMAIL PROTECTED]>
Sent: Friday, January 05, 2001 7:48 PM
Subject: ResultSet Caching


> Does Orion have any built in caching functionality? Let's say I have a
> database query which returns 1,000 records and the user will page thru 100
> at a time.  Instead of re-issuing the query each time (each page), is
there
> some sort of cache object?  How do you guys typically handle this?
>
> Thanks, Neal
>


Reply via email to