Hi All,
Currently we've a non-hibernate based architecture where we've implemented caching the result set at session level.
In the architecture that we just started to work, we'll be using Hibernate. I've following questions regarding this. I would greatly appreciate any input on this.
1. We'll be running our application in Clustered environment and hence we'll use JBoss Cache. Per my understanding (as it's my first hibernate application, i may be wrong), second level cache is synchronized across the cluster meaning, if user A runs a query (list of products) through server A, the second level cache caches the result set. Now user A adds new product. After that user B queries list of products. As the second level cache is configured and clustered, will user B's query to ge tthe list of product include the new product that user A added?
2. Let say i'm running the query to get the list of products. There are 1500 products. Each product has related objects Equipment, ProblemCause, MonitoringDetails etc. Client needs only 50 rows to start with. Is it possible to return first 50 rows immediately after it becomes available and then move on with reading the rest of the objects???
3. Let us say Product has references to object A, B, C and D. But client is interested in only Product and related object As. (don't want B,C and D). Is it possible to read all As but not B, C and D?
4. Our client is non-java (Mac OS X). Hence we need to convert the query results into some XML format and send it. Let us say user A queries the list of Products which has references to object A. So we need to run the query as follows: (let us assume that lazy is "true")
List data = ...find("from product where product.id=?"....)
for(Iterator itr=data.iterator(); itr.hasNext(); ) {
Product product = (Proudct)itr.next();
product.getA();
}
Is that recommended?
Thanks for any input on these questions!
|