-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Writing Hibernate dynamic queries
PostPosted: Thu Aug 25, 2016 11:09 am 
Newbie

Joined: Thu Aug 25, 2016 10:57 am
Posts: 1
We have a requirement to select the required columns based on the few conditions and same with where conditions as mentioned below example.
Could you please help how can i achieve this in HQL writing in the xml file. I don't want to use Criteria for this. Is there way Hibernate supports integration with velocity?
Highly appreciate your inputs.

<sql-query>
select
a
#if($isomeCondition=='Y')
,c
#end
from
table
where
a = '12'
#if($isomeCondition=='Y')
and c is like '%a%'
#end
</sql-query>


Top
 Profile  
 
 Post subject: Re: Writing Hibernate dynamic queries
PostPosted: Mon Aug 29, 2016 6:58 am 
Hibernate Team
Hibernate Team

Joined: Thu Sep 11, 2014 2:50 am
Posts: 1628
Location: Romania
There's no integration with Velocity. In fact, this is the whole purpose of having Criteria API, so that it provides a mechanism to build dynamic entity queries dynamically. The JPA Criteria API allows you to benefit from typesafe queries as well by using the entity Metamodel.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
cron
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.