Issue Type: Improvement Improvement
Affects Versions: 4.1.6
Assignee: Unassigned
Components: core
Created: 06/Feb/13 10:41 AM
Description:

When I do a filter with two related entities with aliases, an error is generated.

1º Test:

Class Employee.java

@FilterDef(name="filterDepartment", parameters=@ParamDef(name="name", type="java.lang.String"))

@Filters({
@Filter(name = "filterDepartment", condition = "{dep}.NAME = :name", aliases = {@SqlFragmentAlias(alias = "dep", table = "DEPARTAMENT")})
})
public class Employee …

@NamedQuery(name=" Employee.querySel", query="select obj.id as id, obj.name as name from Employee obj left join obj.department dep order by obj.id asc")

Error:
org.hibernate.AssertionFailure: Table DEPARTAMENT not found

2º test:

@FilterDef(name=" filterDepartment ", parameters=@ParamDef(name="name", type="java.lang.String"))

@Filters({ @Filter(name = " filterDepartment ", condition = "dep.NAME = :name") })
public class Employee …

@NamedQuery(name=" Employee.querySel", query="select obj.id as id, obj.name as name from Employee obj left join obj.department dep order by obj.id asc")

Error:
Column 'DEP.NAME' is either not in any table in the FROM list or appears within a join specification and is outside the scope of the join specification or appears in a HAVING clause and is not in the GROUP BY list. If this is a CREATE or ALTER TABLE statement then 'DEP.NAME' is not a column in the target table.

Environment: Hibernate version 4.1.6.Final - Data Base Apache Derby
Project: Hibernate ORM
Labels: hibernate HQL query
Priority: Critical Critical
Reporter: Victor Rodrigues Nunes
Original Estimate: 1h
Remaining Estimate: 1h
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira