[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2350?page=c...
]
Gail Badner commented on HHH-2350:
----------------------------------
Here is what is happening:
1) The many-to-one association is (correctly) mapped with update="false"
2) PropertyFactory.buildStandardProperty(...) indicates that the many-to-one association
is not dirty-checkable, unless the many-to-one association is mapped with
not-found="ignore". (It passes alwaysDirtyCheck || property.isUpdateable() to
the StandardProperty constructor; alwaysDirtyCheck is false unless
not-found="ignore").
3) When the entity with an update to the many-to-one association is flushed,
TypeFactory.findDirty(...) does not dirty-check the association because the following is
false:
final boolean dirty = currentState[i] != LazyPropertyInitializer.UNFETCHED_PROPERTY
&& properties[i].isDirtyCheckable( anyUninitializedProperties )
&& properties[i].getType().isDirty( previousState[i], currentState[i],
includeColumns[i], session );
4) The many-to-one association is (correctly) updated in the DB when the dirty non-inverse
collection is updated by CollectionUpdateAction, which evicts the collection from the
second-level cache
5) EntityUpdateAction is responsible for updating/removing a modified entity from the
cache. Since the entity is not dirtied by other updated properties, an EntityUpdateAction
is not created, and so the unmodified entity remains in the cache.
2nd level cache broken for non-inverse bidirectional one-to-many
relation
-------------------------------------------------------------------------
Key: HHH-2350
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2350
Project: Hibernate Core
Issue Type: Bug
Components: caching (L2)
Affects Versions: 3.2.1, 3.5.0-CR-2
Environment: Database: MySQL, HSQL, ... (seems not to be important)
Reporter: Burkhard Graves
Fix For: 3.5.x, 3.6
Attachments: testcase-xml-mapping.tgz, testcase.tgz
When using "non-inverse" one-to-many relations as described in
"2.4.6.2.3. Bidirectional association with indexed collections"
(
http://www.hibernate.org/hib_docs/annotations/reference/en/html/entity.ht...)
hibernate is wrong when activating 2nd level cache.
See the attached example (unzip in /usr/local/hibernate-annotations-3.2.1.GA,
testname=org.hibernate.test.annotations.invonetomany.InverseOneToManyTest).
More details can be found here:
http://forum.hibernate.org/viewtopic.php?t=969456 (and
also in InverseOneToManyTest.java).
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira