|
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.
|