title: JPA - Optional columns
body: <p>We have many customers data in separate databases per customer which should have the same schema/table structures. However there is a table that has extra columns in some databases compared to others.</p>
  
  <p>For example for customer A there is a table X with columns a, b, c, d. For customer B there is a table X with columns a, c, d. I need to capture b if it exists but can ignore it if not.</p>
  
  <p>Is there a way to tell JPA to ignore those columns if they don't exist? <code>@Basic(optional=true)</code> reads exactly like what I want but the documentation indicates it is for another purpose.</p>
  
  <p>Currently I get, as expected, Unknown column 'table.field' in 'field list'</p>
  
  <p>P.S.
  I can't just add the columns to the databases that don't have them unfortunately.</p>