hibernate query cache will throw IllegalArgumentException for lazy loaded fields
--------------------------------------------------------------------------------
Key: CDV-738
URL: https://jira.terracotta.org/jira//browse/CDV-738
Project: Community Development
Issue Type: Bug
Components: Integration Modules
Affects Versions: 2.6-stable1, 2.5.4, trunk-nightly
Reporter: Antonio Si
Assignee: Issue Review Board
Attachments: tc-config.xml, TestHibernate.tar
This forum reports this problem:
http://forums.terracotta.org/forums/posts/list/930.page#5664
Hibernate set a field to LazyPropertyInitializer.UNFETCHED_PROPERTY when a
field is lazily loaded for query cache. The hibernate code use reference
equality to compare with this field to determine if it needs to reload the
field. So, when the we share the query cache (such as using clustered ehcache),
the equality between the DSO object and the hibernate object will return false.
Attached is a sample app to reproduce this problem from Nitin.
After discussing with Tim and Nitin, there are several options to this problem:
1. Make this field a root. Since this is a singleton field of an interface, we
need to change our code to support root in an interface, since we
currently skip instrumentation for interface. We also need to insturment
all classes that is referring to this field so that it will call the getter
method.
2. Change all references to this field to use .equals() method instead of
reference equality.
3. Somehow, mark this field as a special literal object, and when we lookup an
object of this type, use the singleton field of this type instead. In
this case, we do not need to instrument classes that are referring to
this field.
Currently, these are the classes which are referring to this field in hibernate
3.2.5:
org/hibernate/engine/ForeignKeys.java
org/hibernate/engine/Nullability.java
org/hibernate/engine/TwoPhaseLoad.java
org/hibernate/event/def/AbstractVisitor.java
org/hibernate/intercept/LazyPropertyInitializer.java
org/hibernate/persister/entity/AbstractEntityPersister.java
org/hibernate/pretty/Printer.java
org/hibernate/tuple/entity/AbstractEntityTuplizer.java
org/hibernate/type/TypeFactory.java
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
https://jira.terracotta.org/jira//secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
_______________________________________________
tc-dev mailing list
[email protected]
http://lists.terracotta.org/mailman/listinfo/tc-dev