I have an Entity based on a view that has several outer joins of large tables. In addition, it has several other relationships, so the queries generated from the Criteria can be complex, and time-consuming.
The DetachedCriteria is built dynamically from user input, so generating the Criteria itself is complex.
I'm using Projections.rowCount() to determine whether to execute the actually query or not. The problem is, the rowCount() even takes too long if the user-entered Criterion is not specific enough.
It would be great if I could get the rowCount from another entity(different view) that eliminates joins that won't effect the count. Is there another option other than just creating two Criteria objects from the start, and applying the same restrictions to each as the user's input is processed?
There doesn't appear to be a way to change the Entity on an existing DetachedCriteria...
|