Hi Bryan, I've only just started looking at JCS myself, but I don't think that JCS solves your problem exactly as you see it might, i.e. a query able object datastore.
JCS is a caching solution, which means you store objects against keys. Therefore, if the possible outcome of your SQL query produced a manageable number of different results, you could store each of these in the form of say, a disconnected recordset or the marshalled data in a data transfer object, which you could create a unique key for based on the dynamic query input variables. You then store this data in the cache for retrieval when the same query, which produces the same key. If it is not in the cache, you then go to the database and put the results in the cache. Alternatively, the other option which you mention, ' would I have to iterate through a loop, with logic to test for matching values?' However, what you really need is a data access solution which isn't just raw SQL/JDBC. If you look at Hibernate or the Spring framework (which includes a data access solution), what you have here is a data access layer which may be configured to utilise a cache solution of which it then takes care of how it uses the cache. Therefore, you continue to initiate data queries and the framework takes care of deciding if it retrieves the data from the cache or if the underlying data has changed and it needs to access the database and update the cache. There is a learning curve on either of these solutions when compared to raw SQL/JDBC, but it is worth it. I am using Hibernate myself and I find it to be very good. Good luck, Simon -----Original Message----- From: Bryan Hux [mailto:[EMAIL PROTECTED] Sent: 27 February 2006 15:23 To: jcs-users@jakarta.apache.org Subject: 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 This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this message in error please delete it and any files transmitted with it, after notifying [EMAIL PROTECTED] Any opinions expressed in this message may be those of the author and not necessarily those of the company. The company accepts no responsibility for the accuracy or completeness of any information contained herein. This message is not intended to create legal relations between the company and the recipient. Recipients should please note that messages sent via the Internet may be intercepted and that caution should therefore be exercised before dispatching to the company any confidential or sensitive information. Mizuho International plc Bracken House, One Friday Street, London EC4M 9JA. TEL. 020 72361090. Wholly owned subsidiary of Mizuho Securities Co., Ltd. Member of Mizuho Financial Group. Authorised and regulated by the Financial Services Authority. Member of the London Stock Exchange. Registered in England No. 1203696. Registered office as above. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]