• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

Aliases Support in HQL

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 691
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 691
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 691
Mac
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.

 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic