Use of Alias and property references in SQL by R4R Team

In most cases the above alias injection is needed. For queries relating to more complex mappings, like composite properties, inheritance discriminators, collections etc., than we can use specific aliases that allow Hibernate to inject the proper aliases.

The following table shows the different ways you can use the alias injection. Please note that the alias names in the result are simply examples; each alias will have a unique and probably different name when used.




A simple property


A_NAME as {}

A composite property


CURRENCY as {item.amount.currency}, VALUE as {item.amount.value}

Discriminator of an entity


DISC as {item.class}

All properties of an entity



A collection key


ORGID as {coll.key}

The id of an collection


EMPID as {}

The element of an collection


XID as {coll.element}

property of the element in the collection


NAME as {}

All properties of the element in the collection



All properties of the the collection



Leave a Comment:
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!