[
http://opensource.atlassian.com/projects/hibernate/browse/ANN-647?page=co...
]
Geoffrey De Smet commented on ANN-647:
--------------------------------------
Thanks for adding the possible issue :)
From a user's perspective, it would very usefull if HQL/JPA-QL was
allowed in @Where and @OrderBy too.
If there's such an issue already I
couldn't find it.
Problem would be getting a reference to the instance itself, but maybe "this"
can be a solution to that?
For example:
public class X {...
@Where(hql = "childCat in elements[this.cat.kittens]")
public List<Y> get...
}
makes for something like "... from X x left join fetch Y y whre y.childCat in
elements[x.cat.kittens]"
Notice how this is replaced by x (and not y).
@Where JavaDoc does not specify that it describes a SQL fragment
----------------------------------------------------------------
Key: ANN-647
URL:
http://opensource.atlassian.com/projects/hibernate/browse/ANN-647
Project: Hibernate Annotations
Issue Type: Bug
Components: documentation
Affects Versions: 3.3.0.ga
Environment: Mysql 5
Reporter: Geoffrey De Smet
Priority: Minor
Fix For: 3.3.1
The problem is that the "true" gets prefixed with the tablename:
For example this is an annotated class
@ManyToMany(targetEntity = ProjectPO.class, mappedBy="coolholders")
@Where(clause = " cool = 'true' ")
public List<Project> getInCoolProjects()
Here's the generated SQL:
... where ( projectpo1_.cool = projectpo1_.true ) ...
while it should probably be:
... where ( projectpo1_.cool = true ) ...
PS: it's a bit unclear if @Where(clause) accepts SQL or HQL. If it's only SQL,
allowing HQL too would be useful :)
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira