I am using Hibernate 2.1.3 and have some strange behavior. Im doing a proof of concept for standardizing on Hibernate here at work, so any help would be greatly appreciated.
It seems hibernate will not work if I use both a <version> and <cache> tag in the same persistent base class.
If I have caching enabled for the class, and the timestamp/version property mapped as a simple property, the mappings work fine.
Also if I have the timestamp property mapped as the <version> property, with no cache enabled, the mappings work fine.
But If I have both <version> and <cache> in the same mapping file, things get out of whack. First I get a PropertyAccess error telling me to turn off the reflection optimizer, which I did.
Then I ran under the debugger and watched what was going on. the AbstractEntityPersister setter[] gets out of sync with the value[], observed at this line of code, AbstractEntityPersister.221, so the setter for the version property which expects a timestamp, is being passed a String, which is the value of a different persistent property, and throwing an IllegalArgumentException....
Code:
for (int j=0; j<getHydrateSpan(); j++) getSetters()[j].set(object, values[j]);
Could it have something to do with the class hierarchy it looks something like this
Abstract Non Persistent Base Class A
Abstract Persistent Base Classes B,C,D extend A
Concrete Persistent Classes B1,B2,B3 extend B
Concrete Persistent Classes C1,C2,D3 extend C
Concrete Persistent Classes D1,C2,D3 extend D
The inheretence is mapped using table per subclass...
Thnaks for any help..