Hibernate version:
3
I need to reuse a criteria object twice. The first is used to generate an Excel dump, while the second is used to display data to the user. The first has a fixed ordering, so I need to call addOrder() on the criteria object with the ordering I want. But for the query that will display data to the user, the ordering is set by the user.
I can of course clone the Criteria object using serialization and all that, but it seems like an extremely clumsy way of doing it. Instead I would just like to take the Criteria instance, do addOrder("the Excel ordering"), do list(), then do something like deleteOrder("the Excel ordering"). The code handling user ordering will then follow and add ordering depending on user input.
Any good ideas?
|