[
https://hibernate.onjira.com/browse/HHH-7113?page=com.atlassian.jira.plug...
]
Guenther Demetz edited comment on HHH-7113 at 2/27/12 2:39 AM:
---------------------------------------------------------------
Hi,
the workaround above fails to work on NaturalId's in class-hierarchies.
The problem is following:
-the NaturalId-cache of the perstistent context is split up in caches per
entity-persister, good so far.
-when inserting or deleting an entity object, the entity-persister of the concrete object
class is considered.
-when loading an entity object by NaturalId , the entity-persister of the declared object
class is considered.
Concrete and declared classes can be different in class-hierarchies,
as the declared class may be a super class of the concrete class:
// class C extends CC , CC declares NaturalId name
Class declaredClass = C.class;
C c = (C) session.byNaturalId(C.class).using("name", "test").load();
assertTrue (c instanceof CC);
Please consider the attached testcase EnhancedTestCaseModifieableNaturalId.jar and ignore
the previous attachement
was (Author: pb00067):
Hi,
the workaround above fails to work on NaturalId's in class-hierarchies.
The problem is following:
-the NaturalId-cache of the perstistent context is split up in caches per
entity-persister, good so far.
-when inserting or deleting an entity object the entity-persister of the concrete object
class is considered
-when loading an entity object by NaturalId the entity-persister of the declared object
class is considered
The concrete and the declared class may be different classes in class-hierarchies:
// class C extends CC , CC declares NaturalId name
C c = (C) session.byNaturalId(C.class).using("name", "test").load();
assertTrue (c instanceof CC);
Please consider the attached testcase EnhancedTestCaseModifieableNaturalId.jar and ignore
the previous attachement
NaturalIdLoadAccess not properly working on mutable NaturalId's
---------------------------------------------------------------
Key: HHH-7113
URL:
https://hibernate.onjira.com/browse/HHH-7113
Project: Hibernate ORM
Issue Type: Bug
Components: core
Affects Versions: 4.1.0
Environment: Hibernate4.1.0, db independent (HSQLDB used in attached testcase)
Reporter: Guenther Demetz
Labels: naturalId
Attachments: EnhancedTestCaseModifieableNaturalId.jar,
TestCaseModifieableNaturalId.jar
Original Estimate: 16h
Remaining Estimate: 16h
After updating the value of a mutable NaturalId, the entity object can be retrieved with
the new value, but also with the old value.
assertNotSame(session.bySimpleNaturalId(C.class).load("1"),
session.bySimpleNaturalId(C.class).load("3")); --> failing
See attached testcase:
On deletions the internal NaturalId cache is synchronized properly (testDeleteNaturalId)
but not on modifications (testModifieableNaturalId)
--
This message is automatically generated by JIRA.
For more information on JIRA, see:
http://www.atlassian.com/software/jira