]
Christian Bauer updated HHH-2556:
---------------------------------
Priority: Minor (was: Critical)
The property-ref _feature_ can never be critical.
HQL queries with many-to-one joins with property-ref fail
----------------------------------------------------------
Key: HHH-2556
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2556
Project: Hibernate3
Issue Type: Bug
Affects Versions: 3.2.1
Environment: 3.2.1 Sybase 12.x
Reporter: Bill Swayze
Priority: Minor
I am experiencing a similar problem to HHH768. In HQL with many-to-one associations
using a property-ref, the 'one' end of the association (all requisite fields) is
retrieved and partially resolved and saved in entitiesByKey. In subsequent result set
processing, an attempt to resolve the entity in entitiesByUniqueKey is unsuccessful as it
is trying to use the pk. Ultimately, the entity is null in the results of .list().
Consider the following simple mappings and query:
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="test.A"
table="a_t">
<id name="id" column="id"
type="java.lang.Integer">
<generator class="assigned"/>
</id>
<many-to-one name="child" class="test.B"
column="str_id" property-ref="key" not-null="true"/>
</class>
</hibernate-mapping>
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
<hibernate-mapping>
<class name="test.B"
table="b_t">
<id name="id" column="id"
type="java.lang.Integer">
<generator class="assigned"/>
</id>
<property name="data" type="java.lang.String"
column="data" not-null="true" length="80" />
<property name="key" type="java.lang.String"
column="str_id" unique="true" not-null="true"
length="80" />
</class>
</hibernate-mapping>
select aa.id, bb from A aa inner join aa.child bb where aa.id = 1
This query returns all requisite fields along with an additional column that refers to
b's pk. This column is used, erroneously, to try to look up the entity by unique key.
It is not clear to me whether the problem is in the result set processing or the new
query parser.
I was counting on using this functionality to expand our use of Hibernate and ease the
transition of significant amounts of legacy tables.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: