You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jcs-users@jakarta.apache.org by Bryan Hux <br...@discoveryinsurance.com> on 2006/02/27 16:22:58 UTC

Question regarding JCS replacing database queries...

Finally, someone to ask this question to...

 

I have some questions, and the answers will determine whether I
implement JCS to solve a problem. I've read all the documentation and
any other information I could find regarding JCS, and I still can't
decide whether JCS is a feasible solution.

 

I have never programmed against a cache before, but I believe I
understand the process of using java to return a single value from a
cache.

 

What I need to do is to populate 12 listboxes with an array (for each
listbox) of appropriate values. The values almost never change, but they
are each dependent on the value selected in a preceding listbox, so the
answer has to be something that can react to user input at runtime.

 

Without a cache in place, the listboxes would be populated by running
SQL queries against an Oracle database. The queries involve joined
tables and multiple filtering statements in the WHERE clause.

 

For example:

<sql:query var="queryBiLimit" dataSource="jdbc/AutoOracle">

      SELECT  DISTINCT ESC.description AS VALUE

            FROM    PHNX_VALIDATION PV,

                    EDIT_SHORT_CODE ESC

            WHERE   ESC.name = 'BI_LIMIT'

            AND     ESC.tbname = 'PL_AUTO_POL'

            AND     ESC.code = PV.related_value

            AND     PV.related_field = 'UM_UIM_COMBINED'

            AND     PV.related_value IN ('1','2','3','4','5','6')  

            AND     PV.source_table = 'PL_AUTO_POL'

            AND     PV.related_table = 'PL_AUTO_POL'

            AND     PV.source_field = 'UM_BI_LIMIT'

            AND     PV.plan_code IS NOT NULL

            AND     PV.plan_code = ?

            AND     ESC.tbname = PV.RELATED_TABLE

            AND     ESC.description <> '25,000/50,000'

            AND     PV.plan_code IS NOT NULL

            AND     PV.plan_code = ?

            AND     PV.source_value IS NOT NULL

<sql:param value="${agencyDefaultsTerm}"/>

</sql:query>

 

The expected result:

100,000/300,000

250,000/500,000

30,000/60,000

50,000/100,000

Not applicable

 

Is something like this possible with JCS?

Is there anything like SQL that can be used to replicate the query's
functionality (returning an array or a resultset), or would I have to
iterate through a loop, with logic to test for matching values?

 

Thanks for any help you can offer,

 

 

Bryan Hux

Discovery Insurance IS Dept.

Voice 252/523-1200 x4352

FAX 252/208-2581