From: <leg...@at...> - 2003-08-22 10:11:32
|
Message: A new issue has been created in JIRA. --------------------------------------------------------------------- View the issue: http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-282 Here is an overview of the issue: --------------------------------------------------------------------- Key: HB-282 Summary: JCS: Routing *different* classes to *same* JCS Region causes ClassCastException Type: Bug Status: Unassigned Priority: Major Project: Hibernate2 Components: core Versions: 2.1 2.0.1 2.0.2 2.1 beta 1 Assignee: Reporter: Bertrand Renuart Created: Fri, 22 Aug 2003 5:09 AM Updated: Fri, 22 Aug 2003 5:09 AM Description: Summary: -------- Configuring two classes to share the same JCS Region may cause ClassCastException on cache hit. Description: ------------ By default, Hibernate will use different cache regions for each class, the region name being the class name (class name + property path for collections). When using the cache config inside hibernate.cfg.xml, it is possible to specify in which region each class should endup. This way, it is possible to direct different classes to the same region. Internally, Hibernate creates a JCSCache proxy for each class, with a reference to the underlying JCS Region. If two classes share the same region, then two Hibernate JCSCache proxies are created, both pointing to the same JCS Region. Object are put and retrieved in/from JCS using a *key*. Hibernate uses the persistent ID of the class as key (the Serializable than can be used the load() the object). Unfortunately, instances of different classes may have the same ID (say a Long if you use the Increment generator). If they share the same cache region, one instance will override the other (the cache behaves like a Java Map) - confusing Hibernate on retrieve from cache and causing a ClassCastException (either in your code when casting the return of load(), or inside Hibernate in case of collections). --------------------------------------------------------------------- JIRA INFORMATION: 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.jspa If you want more information on JIRA, or have a bug to report see: http://www.atlassian.com/software/jira |