# Dynamic models in hibernate

**URL:** https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268
**Category:** Hibernate ORM
**Created:** [August 22, 2018, 10:03am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268 "2018-08-22T10:03:04Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Naveen](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@Naveen](https://discourse.hibernate.org/u/Naveen)
#### Post date: [August 22, 2018, 10:03am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/1 "2018-08-22T10:03:04Z")

</div>

Hi all,

I am new to hibernate, I am trying to create a hibernate code without pojo class using the dynamic model concept. My requirement is I want to delete a column in oracle database. I don’t how to create a object and how to use dynamic model.  
Can you please suggest me.

---

<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: [August 22, 2018, 10:22am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/2 "2018-08-22T10:22:32Z")

</div>

I moved this to Hibernate ORM since it is not really related to Bean Validation.

If you want to have an schema-less EAV (Entity-Attribute-Value) structure, then JSON works best. You can use the [hibernate-types](https://github.com/vladmihalcea/hibernate-types) project to store JSON with Hibernate.

For an example, check out [this article](https://vladmihalcea.com/how-to-store-schema-less-eav-entity-attribute-value-data-using-json-and-hibernate/).

> **[How to store schema-less EAV (Entity-Attribute-Value) data using JSON and...](https://vladmihalcea.com/how-to-store-schema-less-eav-entity-attribute-value-data-using-json-and-hibernate/)**
>
> (Last Updated On: January 16, 2018)Introduction One of my Twitter followers has recently asked me about a way of storing EAV (Entity-Attribute-Value) data using JPA and Hibernate, and, because this is a very good question, I decided to turn answer it...

---

<div class="post-metadata">

### Author: ![Naveen](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@Naveen](https://discourse.hibernate.org/u/Naveen)
#### Post date: [August 22, 2018, 10:36am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/3 "2018-08-22T10:36:01Z")

</div>

Can you help me on Dynamic models because this will easy my work. I know how to configure in hibenate.properties but i want to know how handle in hibernate program.

Please help me on this topic.

---

<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: [August 22, 2018, 11:02am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/4 "2018-08-22T11:02:44Z")

</div>

Sure, I can. That’s why I sent you that article. Did you read it?

---

<div class="post-metadata">

### Author: ![Naveen](https://avatars.discourse-cdn.com/v4/letter/n/f07891/32.png) [@Naveen](https://discourse.hibernate.org/u/Naveen)
#### Post date: [August 22, 2018, 11:54am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/5 "2018-08-22T11:54:33Z")

</div>

Yes i read it. But what i am referring is entirely different. Let me explain you what is my requirement.

I got a project like i have to create a dynamic program in hibernate to delete column in the database. now currently i have to delete in one databases, after few we will get more databases to perform the similar operation. For this i am writing one common hibernate program(i am not touching this program for the second database requirement), i am calling the different databases using the mapping and configurations file . For each database i will create a mapping file and configuration file but for each database i have to create a unique POJO class right. So in order to avoid that i want to use dynamic modelling so that i won’t write POJO class for every database.

Please let me know if it is not clear.

---

<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: [August 22, 2018, 12:09pm UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/6 "2018-08-22T12:09:41Z")

</div>

I don’t understand your use case. But you probably don’t need to write any such tool. Just use [FlywayDB](https://flywaydb.org) to manage the DB schema.

Nevertheless, Hibernate does not support dynamic mappings. The only way to make the mapping more dynamic is to build the XML config dynamically prior to bootstrapping.

---

<div class="post-metadata">

### Author: ![Haruji\_Burke](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/haruji_burke/32/957_2.png) [@Haruji\_Burke](https://discourse.hibernate.org/u/Haruji_Burke)
#### Post date: [February 18, 2020, 10:09am UTC](https://discourse.hibernate.org/t/dynamic-models-in-hibernate/1268/7 "2020-02-18T10:09:35Z")

</div>

Dear sir,  
May i have ask about Hibernate performance with generating XML config dynamically?  
Will it slow since app must write/read xml?
