[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5878?page=c...
]
Ian Simpson edited comment on HHH-5878 at 1/27/11 4:18 PM:
-----------------------------------------------------------
Sorry, screwed up that second block and I don't appear to be able to edit anything:
{code}
(SELECT COUNT(1)
FROM sometable st
AND st.othertable_id IN
( SELECT DISTINCT otherta0_.id
FROM othertable ot otherta0_.start otherta0_.with ot.id = otherta0_.id
otherta0_.connect BY otherta0_.nocycle otherta0_.prior ot.id = ot.parent_id
)
)
{code}
If someone else could replace what's in the description with that I'd be
appreciative :)
was (Author: theotherian):
Sorry, screwed up that second block and I don't appear to be able to edit
anything:
{code}
(SELECT COUNT(1)
FROM sometable st
AND st.othertable_id IN
( SELECT DISTINCT otherta0_.id
FROM othertable ot otherta0_.start otherta0_.with ot.id = otherta0_.id
otherta0_.connect BY otherta0_.nocycle otherta0_.prior ot.id = ot.parent_id
)
)
{code}
Add ability to mark keywords as protected dynamically to prevent
table aliasing when using @Formula
---------------------------------------------------------------------------------------------------
Key: HHH-5878
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-5878
Project: Hibernate Core
Issue Type: New Feature
Components: annotations, core
Affects Versions: 3.2.5
Environment: 3.2.5.ga/Oracle 11g database
Reporter: Ian Simpson
Using the following in a @Formula does not work due to keywords being aliased to the
entity the formula is part of:
{code}
@Formula("(select count(1) from sometable st " +
"where st.othertable_id in ( " +
"select distinct id from othertable ot " +
"start with ot.id = id " +
"connect by nocycle prior ot.id = ot.parent_id " +
"))"
)
{code}
The end result is:
{code}
(SELECT COUNT(1)
FROM sometable st
AND st.othertable_id IN
( SELECT DISTINCT otherta0_.id
FROM othertable ot otherta0_.start otherta0_.with cc.id = otherta0_.id
otherta0_.connect BY otherta0_.nocycle otherta0_.prior cc.id = cc.parent_id
)
)
{code}
What (I think) might be preferable is being able to indicate that certain parts are
keywords and that they shouldn't be aliased. The inverse is already doable by adding
backticks to a field/table/whatever that does match a protected keyword. For example:
{code}
@Formula("(select count(1) from sometable st " +
"where st.othertable_id in ( " +
"select distinct id from othertable ot " +
"!!start !!with ot.id = id " +
"!!connect by nocycle !!prior ot.id = ot.parent_id " +
"))"
)
{code}
... or something of that nature which Hibernate can seek out a know to process
differently. I have no idea if "!!" would be usable, but I think you get what
I'm saying.
--
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