# Dynamic native query

**URL:** <https://discourse.hibernate.org/t/dynamic-native-query/6590>\
**Category:** Hibernate ORM\
**Created:** [August 17, 2022, 8:47am UTC](https://discourse.hibernate.org/t/dynamic-native-query/6590 "2022-08-17T08:47:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Swarnkar](https://avatars.discourse-cdn.com/v4/letter/s/f4b2a3/32.png) [@Swarnkar](https://discourse.hibernate.org/u/Swarnkar)\
**Post date:** [August 17, 2022, 8:47am UTC](https://discourse.hibernate.org/t/dynamic-native-query/6590/1 "2022-08-17T08:47:15Z")

</div>

I have a requirement to create dynamic query. its native as some specific database keyword which only works it that DB,  
I am using Spring boot.  
Issue is I can not use the Entity Manger out of the box as we have seen issues if do so.  
can u please guide the resources or some example to do so

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [August 17, 2022, 10:44am UTC](https://discourse.hibernate.org/t/dynamic-native-query/6590/2 "2022-08-17T10:44:48Z")

</div>

If you can’t use Hibernate or JPA APIs, your question probably is better suited to a Spring forum, rather than the Hibernate forum. Having said that, AFAIK dynamic native queries can only be done by calling `EntityManager.createNativeQuery`. So ditch these Spring abstractions and use Hibernate directly.

> Issue is I can not use the Entity Manger out of the box as we have seen issues if do so.

Then tell us what issues you are facing and we might be able to help you.
