[hibernate-issues] [Hibernate-JIRA] Created: (HHH-3630) When querying for component, Map collections inside components not loaded

Gino Miceli (JIRA) noreply at atlassian.com
Wed Dec 3 08:23:16 EST 2008


When querying for component, Map collections  inside components not loaded
--------------------------------------------------------------------------

                 Key: HHH-3630
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-3630
             Project: Hibernate Core
          Issue Type: Bug
         Environment: 3.2.6-GA, Oracle and HSQLDB, JDK 1.5
            Reporter: Gino Miceli
         Attachments: hibernate-test.zip

Given the following mapping:
<code>
    <class name="Car" table="CAR">
        <id name="id" column="ID" type="long">
            <generator class="native"/>
        </id>
       	<property name="make" column="MAKE"/>
        <property name="model" column="MODEL"/>
		<component name="engine" class="Engine">
        	<property name="make" column="ENGINE_MAKE"/>
        	<property name="model" column="ENGINE_MODEL"/>
			<map name="mountParts" table="ENGINE_MOUNT">
				<key column="CAR_ID"/>
				<map-key column="PART_NAME" type="string" />
				<element column="PART" type="string" />
			</map>
		</component>
    </class>
</code>

We are able to get the entire Car object in HQL like so:
<code>
select car from Car car where car.id=1
</code>

This generates the following SQL:
<code>
    select
        mountparts0_.CAR_ID as CAR1_0_,
        mountparts0_.PART as PART0_,
        mountparts0_.PART_NAME as PART3_0_ 
    from
        ENGINE_MOUNT mountparts0_ 
    where
        mountparts0_.CAR_ID=?
</code>

In this case, the map contained in the 'engine' component is loaded correctly.  If we query the component property directly, however:

<code>
select car.engine from Car car where car.id=1
</code>

Instances of Engine are returned, however the contained map is null.  Looking at the SQL, it appears not attempt is made to load the inner map property:

<code>
    select
        car0_.ENGINE_MAKE as col_0_0_,
        car0_.ENGINE_MODEL as col_0_1_ 
    from
        CAR car0_ 
    where
        car0_.ID=1
</code>

Anyone?!

-- 
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
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the hibernate-issues mailing list