title: EclipseLink "create-or-extend-tables" not working: "...unknown column..."
body: <p>I am using EclipseLink 2.4.1 with Glassfish and a MySQL database for persisting entities. <br>
  I added a field to an entity, and when I try to persist this entity it says the new field is 'unknown'.<br>
  How are we supposed to use the new 'create-or-extend-tables' feature? I would have thought it would create a new column for this field. </p>
  
  <p>Some relevant information is below, let me know if you want more.</p>
  
  <p>Thanks in advance!</p>
  
  <p><strong>Stack Trace</strong></p>
  
  <pre><code>...
  Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.1.v20121003 ad44345): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Unknown column 't0.TESTFIELD' in 'field list'
  Error Code: 1054
  at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
  ...
  </code></pre>
  
  <p><strong>persistence.xml</strong>:</p>
  
  <pre><code>&lt;persistence-unit name="myApp" transaction-type="JTA"&gt;
  &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
  &lt;jta-data-source&gt;jdbc/mysql&lt;/jta-data-source&gt;
  &lt;mapping-file&gt;META-INF/orm.xml&lt;/mapping-file&gt;
  &lt;properties&gt;
    &lt;property name="eclipselink.ddl-generation.output-mode" value="database"/&gt;
    &lt;property name="eclipselink.jdbc.batch-writing" value="Buffered"/&gt;
    &lt;property name="eclipselink.logging.level" value="INFO"/&gt;
    &lt;property name="eclipselink.ddl-generation" value="create-or-extend-tables"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p></p>
  
  <p><strong>Extra Info</strong></p>
  
  <p>drop-and-create-tables does work.<br>
  I am using merge(entity) to persist new entities (as they have lots of many to one fields which causes duplicate primary id issues otherwise) - I feel this may be the issue. <br>
  Looking at the MySQL log, and the finest log level from EclipseLink, EclipseLink first tries to select the entity from the database as follows:<br>
  mysql_log:<br></p>
  
  <pre><code>121115 10:49:03 9 Query SELECT t0.LISTINGID, t0.DTYPE, ... , t0.TESTFIELD FROM the_entity...
  </code></pre>
  
  <p>This is the last mysql log entry, meaning that it crashes here, it never tries to drop the table etc. Does this mean you cannot use merge with drop-and-create or create-or-extend? I just did a google and didn't find any info on this.</p>
  
  <p>EclipseLink Logging:</p>
  
  <pre><code>FINER: client acquired: 64279491
  FINER: TX binding to tx mgr, status=STATUS_ACTIVE
  FINER: acquire unit of work: 161130796
  FINEST: Merge clone with references nz.co.site.api.v1.ListedItemDetail@8d88ca1
  FINEST: Execute query ReadObjectQuery(referenceClass=ListedItemDetail )
  FINEST: Connection acquired from connection pool [read].
  FINEST: reconnecting to external connection pool
  FINE: SELECT t0.LISTINGID, t0.DTYPE, ... , t0.TESTFIELD, ... , FROM ITEM t0, LISTEDITEMDETAIL t1 WHERE ((t0.LISTINGID = ?) AND ((t1.LISTINGID = t0.LISTINGID) AND (t0.DTYPE = ?)))
  bind =&gt; [2 parameters bound]
  FINE: SELECT 1
  FINEST: Connection released to connection pool [read].
  WARNING: Local Exception Stack: 
  Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.4.1.v20121003-ad44345): org.eclipse.persistence.exceptions.DatabaseException
  </code></pre>
  
  <p>I use bean transaction management to merge new entities:</p>
  
  <pre><code>userTransaction.begin();
  entityManager.merge(entity);
  entityManager.flush();
  userTransaction.commit();
  </code></pre>