# How to change Hibernate schema at run time

**URL:** https://discourse.hibernate.org/t/how-to-change-hibernate-schema-at-run-time/1093
**Category:** Hibernate ORM
**Created:** [July 20, 2018, 3:15pm UTC](https://discourse.hibernate.org/t/how-to-change-hibernate-schema-at-run-time/1093 "2018-07-20T15:15:29Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![Riddhi\_Dedhiya](https://avatars.discourse-cdn.com/v4/letter/r/54ee81/32.png) [@Riddhi\_Dedhiya](https://discourse.hibernate.org/u/Riddhi_Dedhiya)
#### Post date: [July 20, 2018, 3:15pm UTC](https://discourse.hibernate.org/t/how-to-change-hibernate-schema-at-run-time/1093/1 "2018-07-20T15:15:29Z")

</div>

I have A requirement where the current schema to be used is stored in db table;(schema\_a or schema\_b).

The application is loaded with default schema spring.jpa.properties.hibernate.default\_schema=schema\_a Now when the data in table is updated to B I want to consider all jpa query to use schema\_b without any down time at server.

---

<div class="post-metadata">

### Author: ![vlad](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/vlad/32/658_2.png) [@vlad](https://discourse.hibernate.org/u/vlad)
#### Post date: [July 23, 2018, 7:32am UTC](https://discourse.hibernate.org/t/how-to-change-hibernate-schema-at-run-time/1093/2 "2018-07-23T07:32:48Z")

</div>

You can use schema-based multitenancy. Check out the [User Guide](http://docs.jboss.org/hibernate/orm/5.3/userguide/html_single/Hibernate_User_Guide.html#multitenacy) for more details.
