Dynamic models in hibernate

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.

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 project to store JSON with Hibernate.

For an example, check out this article.

1 Like

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.

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

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.

I don’t understand your use case. But you probably don’t need to write any such tool. Just use FlywayDB 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.

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