Using formula-based property causes invalid SQL code for children "subselect" query

Description

I have simple one-to-many relationship, mapped as set:

<class name="Parent">
<set name="children" lazy="false" fetch="subselect">
<key column="PARENT_OID"/>
<one-to-many class="Child"/>
</set>
</class>

this works fine, constructing subselect SQL which looks like (e.g. for HQL query "from Parent"):
select <child fields> from <child table> where child.PARENT_OID in (select this_.OID from PARENT this_)
(simplified)

However, when adding a formula-based property into Parent:
<property name="myFormulaField" formula="(complex_select )"/>

Now SQL becomes:
select <child fields> from <child table> where PARENT_OID in (complex_select) as formula0_1_, <some parent fields> from PARENT this_)

This SQL fails because of incorrect grammar (it also seems that backet is missing).

This is something weird, because subselect fetching only needs Parent's identity column, not any other properties. And I don't think it should be affected by Parent's formula-based properties.

I can provide more details if necessary, I stripped out all extra mapping/SQL stuff because it seems to be irrelevant here.

This bug appeared in 3.0.5 later I've downloaded 3.1rc3 and it also fails.

Environment

Hibernate 3.0.5, Hibernate 3.1rc3
Oracle 8i

Activity

Show:
GavinG
November 26, 2005, 11:22 AM

You must provide a simple, easily runnable test case.

Steve Ebersole
March 21, 2011, 6:59 PM

Closing stale resolved issues

Incomplete

Assignee

Unassigned

Reporter

SergeyN

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure