• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Aliases Support in HQL

 
Halcon Guatemala
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi guys, I'm doing a query with HQL retrieving properties of several classes and I'm using a plain class for get the result, but I need to use aliases for properties in projection, but I'm getting a message error:



how can I name the alias in projection?

Thanks
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hope this helps.
from Distributor as dist where (dist.DistbrNm like ?)
[ October 13, 2006: Message edited by: Jignesh Patel ]
 
Halcon Guatemala
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jignesh, Thanks for your reply, I've used the notation for alias You suggest:

from Distributor as dist where (dist.DistbrNm like ?)

however my code is throwing an exception, I think my set (IDE, Hibernate3 Lib, Database) doesn't support the aliases, because I get an error about expecting ',' when my code is '... as ...'

Thanks
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hibernate supports aliases from 2.x(or may be before that).
 
Halcon Guatemala
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Jignesh, I don't think hibernate3 doesn't support aliases. I'm explaining ...

doesn't work in my application
but,

runs without errors...
do you know why is my problem?

Thanks
 
Jignesh Patel
Ranch Hand
Posts: 626
Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

assuming codigoImpuesto is a one column in your table, and you are trying to assign alias to the column name.
 
Halcon Guatemala
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks again Jignesh , I stay thinking my set (IDE, database and tools) doesn't work fine with aliases, but my IDE doesn't provide docs about it.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic