HQL generates inner join when selecting a specific attribute that is linked to another entity

Description

Mapping (note the lazy='false', it is essential to cause the problem):
<class name='Currency' lazy='false'>
....
</class>

<class name='Asset'>
<id name='id' ... </id>
<many-to-one name='currency' class='Currency' fetch='select'/>
</class>

The following HQL query: "select a.id, a.currency from Asset a"

used to generate a query on the Asset table, and subsequently generates separate queries on the Currency table.

Since version 3.2.2, this generates an inner join on Asset with Currency.
Now many Assets may have a NULL currency, so we do not get all records anymore!
This breaks logic and queries all over the place for us.

We can't go back to 3.2.1 due to other bugs that had been solved in 3.2.2.

The query "from Asset a" still works OK and as before, i.e. it makes the select only on the Asset table and afterwards fetches the Currency with individual selects.

I fear that an optimization has been made that has this negative side effect.

Activity

Steve EbersoleMarch 21, 2011 at 7:09 PM

Bulk closing stale resolved issues

Duplicate

Details

Assignee

Reporter

Components

Affects versions

Priority

Created February 1, 2007 at 6:51 PM
Updated March 21, 2011 at 7:09 PM
Resolved September 21, 2010 at 7:20 PM

Flag notifications