Hi all.
I tested Hibernate cache and it works very well.
My problem is that 2 sessions will not return 2 objects wich are the same instance (do not compare correctly with ==).
I know this is a feature, not a bug and I understand why it is this way.
But my problem is :
Objects have properties that are mapped in the SGDB and properties that are not.
Properties that are not are calculated. For example, there may be a field with html that is parsed and affected to calculated properties.
The point I wan't to came is that, even if DB acces are cached, those fields are calculated for each sessions.
This happen, of course, on objects that should be shared between sessions and where there is no need for transactions. They might be modified and saved, but the state should be replicated immediately everywhere across the jvm. This can be do only if there is *only one* instance shared.
So, is there a way/pattern/technique to handle those objects with hibernate ?
Actually I use a cache over Hibernate but it complicate design.
This problem must have a solution somewhere because it is a common problem on editorial web sites that are 95% read-only.
Thanks in advance for any advice.
|