Message:
A new issue has been created in JIRA.
---------------------------------------------------------------------
View the issue:
http://opensource.atlassian.com/projects/hibernate/secure/ViewIssue.jspa?key=HB-422
Here is an overview of the issue:
---------------------------------------------------------------------
Key: HB-422
Summary: any.class and binding HQL parameters
Type: Improvement
Status: Unassigned
Priority: Major
Project: Hibernate2
Components:
core
Versions:
2.1 beta 4
Assignee:
Reporter: Matjaz Smolej
Created: Thu, 23 Oct 2003 8:33 AM
Updated: Thu, 23 Oct 2003 8:33 AM
Description:
I have a persistent class with a property mapped with "any". Excerpt from the mapping file:
---
<any name="item" id-type="long" meta-type="eg.MyUserType">
<column name="Type"/>
<column name="ID"/>
</any>
---
Consider the following HQL where log.item is a property mapped with "any":
---
from eg.AuditLog log where log.item.class = :itemClass
---
When binding query parameter "itemClass" using method:
Query#setParameter(String name, Object value)
one cannot use the preferred Class instance as the value parameter, but needs to use it's mapped value produced by any's meta-type.
If one wants to use the Class instance as a parameter, he must use the method:
Query#setParameter(String name, Object value, Type type)
where type must be the same as specified with any's meta-type attribute (eg. Hibernate.custom(eg.MyUserType.class)).
I think this is redundant since Hibernate already knows the "meta-type" specified in "any" mapping. Hibernate could use this meta-type as a default type when binding query parameters using method Query#setParameter(String name, Object value).
---------------------------------------------------------------------
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
|