Hibernate currently provides a way to denote a class as immutable, and thus shoudlnt be dirty checked (as it cannot change).
Is there a way to denote that the resulting objects of a query are to be considered immutable for the session unless explicitly passed to update?
The issue is that we have considerable amounts of data in a long running session, the majority of which (in relation to that particular session) is just "extra imformation" and is effectivly immutable. The application will not change it in anyway. We are not evicting the data, as this results in poor performance due reconstituting and re-querying the db. Additionally these "extra" objects are referenced (via mapped properties) so they cannot be evicted from the session.
Example :
An Invoice has a reference to a Vendor. The user is allowed select from a list of vendors in the UI. This means that all vendors are pulled from the DB, and stored in the session. Since they are in the session the wont ever need tobe re-constituted, and no special prep has tobe done to re-associate the vendor with the session when the user selects any given vendor from the list. So when the Invoice is passed to saveOrUpdate it references a non-transient Vendor.
|