title: Spring Boot: Altering database tables at runtime
body: <p>Currently developing a web application using Spring Boot where a user is expected to upload .CSV files with contacts to populate the database.</p>
  <ul>
  <li>Each .CSV file (contacts list) may have a different set of columns (Such as: Name, Email, Address, etc..).</li>
  <li>Each list may contain thousands of records.</li>
  <li>The application involves reading and writing each of the lists individually.</li>
  <li>The app also must provide for insertion/deletion of columns.</li>
  </ul>
  <p><strong>Question 1</strong>: what is the best approach to insert such data to the database?</p>
  <p>So far I could think of two options:</p>
  <p>Having a single table which will contain all the data from all of the lists.<br />
  <a href="https://i.stack.imgur.com/bAnXH.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/bAnXH.png" alt="Having a single table which will contain all the data from all of the lists." /></a></p>
  <p>OR</p>
  <p>Create a new table for every new list.<br />
  <a href="https://i.stack.imgur.com/fSfrU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fSfrU.png" alt="Create a new table for every new list." /></a></p>
  <p><strong>Question 2</strong>: Whilst the first option is easy to implement using Spring Boot's JPA + Hibernate, I'm not sure how to approach the second one. Since the fields are different from list to list, we cannot provide a resource representation class. Any suggestions?</p>
  <p><strong>Question 3</strong>: Having resource representation classes and using Hibernate is it even possible to dynamically alter database tables (insertion/deletion of columns)?</p>