Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-562
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-562
Summary: Using Session.load(Class, Serializable) Proxy is of incorrect type
Type: Bug
Status: Unassigned
Priority: Major
Project: Hibernate2
Components:
core
Versions:
2.0.3
Assignee:
Reporter: Tom Sedge
Created: Wed, 17 Dec 2003 7:27 AM
Updated: Wed, 17 Dec 2003 7:27 AM
Environment: Windows 2000, Sun JDK
Description:
Possibly, this may be considered a feature rather than a bug.
Suppose I have two classes, say Product and Computer, where Computer extends Product. Both are proxied by Hibernate.
In a generic application I wish to load and step through all Products using Session.load(Product.class, <id>). If I use Session.load(Product.class, <Computer Id>), the Computer object is correctly loaded and wrapped in a Proxy. It behaves as a Computer.
However, the Proxy thinks it is wrapping a Product, not a Computer, because it uses the class requested. This means that Computer.class.isAssignableFrom(<proxy>.getClass()) fails.
I consider this a bug, even though I know Product.class has been requested. That's because for an unproxied object you get a Computer instance, not a Product, so the behaviour depends on whether the object is proxied.
P.S.: It is not possible for the generic application to know that it is about to load a Computer subclass, so it must rely on loading using Product.class, which works fine with unproxied classes.
---------------------------------------------------------------------
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
|