-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 
Author Message
 Post subject: comments in named queries?
PostPosted: Thu Jun 09, 2005 1:52 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
Hibernate version:3.0.5

Does Hibernate support SQL comments in named queries? I tried to include comments using '--', and the parser doesn't seem to like it. I got QuerySyntaxError: unexpected token.

Is there any other way to inlude a comment inline with my HQL queries?

Thanks in advance.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 3:59 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
I was hoping to get an answer on this, even if it's a 'not implemented - contributions are welcome'. I am externalizing some queries that were in java code and had comments from the query creators, and I'd like to preserve those comments. Essentially I'd like to be able to do something like this:

Code:
<query name="mytable.byothercolumn">
<![CDATA[
from MyTable as mytable
where mytable.SomeColumn = :val
        -- HERE I WOULD LIKE TO ADD A COMMENT
   and mytable.OtherColumn = :otherval
]]>
</query>

I just want to make sure that this is indeed NOT implemented, and I am not just overlooking something. Thanks.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 5:19 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
that is a sql query not a hql query. use <sql-query> and it should work.

_________________
Max
Don't forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 5:34 pm 
Expert
Expert

Joined: Wed Apr 06, 2005 5:03 pm
Posts: 273
Location: Salt Lake City, Utah, USA
I just made up that example query, but it was meant to be an HQL query.

What I'm asking is: does HQL support comments in any form?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 10, 2005 5:38 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 6:10 am
Posts: 8615
Location: Neuchatel, Switzerland (Danish)
no - only via query.setComment()

_________________
Max
Don't forget to rate


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.