Dynamic table and column mapping


#1

Hi everybody,
first of all, I would like to apologize for my poor english level, Iā€™m simply a French guy :wink:

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

  • 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 :wink:

Thanks for any feedback.
Regards
Nicolas


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

#3

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