File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes escaping SQL keywords in hibernate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "escaping SQL keywords in hibernate" Watch "escaping SQL keywords in hibernate" New topic
Author

escaping SQL keywords in hibernate

Chandra shekar M
Ranch Hand

Joined: Dec 20, 2006
Posts: 155
Hi

I have a hibernate foruma like this.
<formula>
(select listagg(size,',') WITHIN group (order by size) from (select distinct(size) from a where id = 10 ))
</formula>

Hibernate is not identify WITHIN as keyword instead it prefixs it with table a alias to avoid this i wrote it like
<formula>
(select listagg(size,',') 'WITHIN' group (order by size) from (select distinct(size) from a where id = 10 ))
</formula>

Hibernate will not prefix the table alias instead it will be 'WITHIN' in the final query and SQL fails saying missing WITHIN keyword. How to pass WITHIN
to final sql?

Thanks
Chandra
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: escaping SQL keywords in hibernate
 
It's not a secret anymore!