I have a readonly model that is mapped to a view using annotations. For optimization reasons I would like to be able to dynamically change the view that the model is mapped to on runtime. The views will contain the same structure and will be in the same database schema. I found the following blog post on using the HibernateInterceptor interface to intercept the prepared statement and then change the view name in the select.
[url]
http://www.alvinsingh.org/blog/2008/06/ ... e-routing/
[/url]
I'm wondering if:
1. This only effects the current session or if it's context based?
2. It's session based will I need to change the prepared statement back to it's original form after I'm done with the query?
3. If there is a better way to do this.
[/url]