[jboss-user] [Persistence, JBoss/CMP, Hibernate, Database] - Re: IllegalArgumentException( argument type mismatch) when u

peter_zat do-not-reply at jboss.com
Thu Apr 10 09:49:00 EDT 2008


After poking at this a bit more, I think I sort of understand what was going on (though I don't really know why) and have a resolution which I am mostly confident in (but some reassurance would be nice!)

It appears to be a problem with the way Hibernate uses the JBoss cache.  Hibernate is storing a CacheEntry in the clustered JBoss TreeCache for each entity instance.  This CacheEntry seems to store an array of property values, the order of which is determined by some metadata, presumably gathered by introspection of the entity's class.  When pulling data out of the cache, it again uses this metadata to put those values back into the correct entity properties.

The assumption seems to be that in two different JVMs this metadata about the entity is constructed identically; i.e. the properties are listed in the same order.  If the second JVM for some reason has the properties in a different order, then when reconstructing an entity from a CacheEntry, it tries to stuff values into the wrong properties.

I turned on the hibernate.cache.use_structured_entries setting and now instead of a CacheEntry that uses an array with an assumed order, it uses a StructuredCacheEntry (I think) which seems to use Map semantics (i.e. key=value) and now my 2nd JVM gets the values in their correct properties.

Does anyone with deeper understanding of Hibernate and/or JBoss cache have any thoughts on this?  Is this is a good workaround?

I think this may be a bug in Hibernate and I'll go file an issue in their Jira.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4143180#4143180

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4143180



More information about the jboss-user mailing list