How to query in hibernate with alias Bean Class which has annotated fields?
<p>In hibernate I am creating custom query like below.</p>

<pre><code>Query query = getSession()
            .createSQLQuery(
                    "select t2.* from ( select (select id from ctc_ver_assets ti where ti.ctcassettag = t1.ctcassettag  order by ti.createddate desc limit 1) lid from "
                            + "( select distinct ctcassettag from ctc_ver_assets) t1) ro, ctc_ver_assets t2 where t2.id = ro.lid and date(createddate) ")
            .setResultTransformer(Transformers.aliasToBean(VerificationAsset.class));
</code></pre>

<p>My verificationAsset class contains field namely ctcAssetTag but the field name in table is ctcassettag. How can I map this to the object automatically? </p>

<p>I can rename the individual fields in the query itself like <code>t2.ctcassettag as ctcAssetTag</code>. But I do not want to do that for each field because I already annotated each field in my Bean class like below</p>

<pre><code>@Column(name = "ctcassettag", unique = true, nullable = false)
private String ctcAssetTag;
</code></pre>

<p>When I use criteria it is working fine. How to achieve the same with query?</p>