Hibernate version: 3.2.4
Name and version of the database we are using: Oracle 9i
I have a general question about object fetching. We are working on the system where all objects are efficiently immutable, i.e. all changes of the objects are done elswhere and our application (GUI) only shows the data from the database. Each change we need to do is communicated to the backend and backend notify GUIs as soon as changes are done and information in the GUI need to be refreshed.
The problem is that as in any normal GUI (swing) we don't have a web-specific request/response flow, where database connection is reoppened every request, connection is open always as long as GUI client is running.
Since all information is immutable and we have notifications from the backend we need to cache everything, means every object from the database needed to be cached, it's possible with Hibernate and with 2nd level caching, it work perfect.
There are however some issues with notifications, because according to the classical MVC, Model need to notify View about any changes, therefore when for example object instance was modified in the backend then all view that are showing given model object should be notified, in combination with object immutability this effectively means that we should only have one instance of every persistent object in the system available, and no second instance should exists (say one instance of User with ID=2 and one instance User#3).
My question is that is it possible to support given requirements with Hibernate, because since 2nd level cache caches dehydrated instances, each time new object instance is fetched (allthough with the same data).
Is there any possibility to enable instance-level caching which will be safe enough approach when all objects are immutable?
Thank you,
Renat
_________________ Br.
Renat
|