# Dynamic table and column mapping

**URL:** <https://discourse.hibernate.org/t/dynamic-table-and-column-mapping/722>\
**Category:** Hibernate ORM\
**Created:** [May 9, 2018, 8:07am UTC](https://discourse.hibernate.org/t/dynamic-table-and-column-mapping/722 "2018-05-09T08:07:00Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicolas\_felix](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@nicolas\_felix](https://discourse.hibernate.org/u/nicolas_felix)\
**Post date:** [May 9, 2018, 8:07am UTC](https://discourse.hibernate.org/t/dynamic-table-and-column-mapping/722/1 "2018-05-09T08:07:00Z")

</div>

Hi everybody,  
first of all, I would like to apologize for my poor english level, I’m simply a French guy 😉

As briefly specified in the title, I would like to know 2 things 🙂

- If I have similar structured tables, can I map them to same entities and make them available into hibernate context ?
- If I have dynamic columns (added / removed from tables), is there any way to make hibernate context/session aware of those columns ?

I’m aware these 2 topics/questions might have been splitted, but I did not want to flood he forum for my first post 😉

Thanks for any feedback.  
Regards  
Nicolas

---

<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:** [May 9, 2018, 6:14pm UTC](https://discourse.hibernate.org/t/dynamic-table-and-column-mapping/722/2 "2018-05-09T18:14:05Z")

</div>

1. You could use @MappedSuperclass for reusing some common properties.
2. Dynamically adding properties does not work without restarting the Hibernate SessionFactory.

---

<div class="post-metadata">

**Author:** ![nicolas\_felix](https://avatars.discourse-cdn.com/v4/letter/n/4af34b/32.png) [@nicolas\_felix](https://discourse.hibernate.org/u/nicolas_felix)\
**Post date:** [May 14, 2018, 2:41pm UTC](https://discourse.hibernate.org/t/dynamic-table-and-column-mapping/722/3 "2018-05-14T14:41:52Z")

</div>

Hi Vlad,  
thank you for your answer.

1. I will have a look at this annotation. At first reading, it seems to fit my needs.
2. I was afraid of this need (restarting hibernate _SessionFactory_), as I find it a little bit slow. But I will check deeper why I have got this feeling (and above all, I will add some metrics).

Thanks again,  
Nicolas
