title: JPA 2.1 Schema gereration problems
body: <p>I'm trying to use pure JPA 2.1 as a standardized way to generate db schema.
  (Underlying database - Derby embedded,  persistence provider - eclipseLink)</p>
  
  <p>To check generated scripts I set <code>&lt;property name="javax.persistence.schema-generation-target" value="database-and-scripts"/&gt;</code>
  And as a result I got it with some 'sequence' table within.
  And although ... <code>ERROR 42X05: Table/View 'SEQUENCE' does not exist.</code></p>
  
  <p>Can somebody help to understand such a weird behavior?</p>
  
  <p>maven dependencies:</p>
  
  <pre><code>&lt;dependency&gt;
      &lt;groupId&gt;org.eclipse.persistence&lt;/groupId&gt;
      &lt;artifactId&gt;org.eclipse.persistence.jpa&lt;/artifactId&gt;
      &lt;version&gt;2.6.0&lt;/version&gt;
  &lt;/dependency&gt;
  &lt;dependency&gt;
      &lt;groupId&gt;org.apache.derby&lt;/groupId&gt;
      &lt;artifactId&gt;derby&lt;/artifactId&gt;
      &lt;version&gt;10.9.1.0&lt;/version&gt;
  &lt;/dependency&gt;
  </code></pre>
  
  <p>Entity:</p>
  
  <pre><code>import javax.persistence.*;
  
  @Entity
  public class Book {
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
      private String title;
  // getters/setters/constructors
  }
  </code></pre>
  
  <p>main body:</p>
  
  <pre><code>EntityManagerFactory emf = Persistence.createEntityManagerFactory("chapter04PU");
  EntityManager em = emf.createEntityManager();
  
  EntityTransaction tx = em.getTransaction();
  tx.begin();
  em.persist(new Book("Neuromancer"));
  tx.commit();
  
  em.close();
  emf.close();
  </code></pre>
  
  <p>persistence-unit:</p>
  
  <pre><code>&lt;persistence-unit name="chapter04PU" transaction-type="RESOURCE_LOCAL"&gt;
      &lt;provider&gt;org.eclipse.persistence.jpa.PersistenceProvider&lt;/provider&gt;
  
      &lt;class&gt;Book&lt;/class&gt;
      &lt;properties&gt;
          &lt;!--&lt;property name="eclipselink.ddl-generation" value="drop-and-create-tables"/&gt;--&gt;
          &lt;property name="javax.persistence.schema-generation-action" value="drop-and-create"/&gt;
          &lt;property name="javax.persistence.schema-generation-target" value="database-and-scripts"/&gt;
      &lt;property name="javax.persistence.schema-generation.scripts.action" value="drop-and-create"/&gt;
      &lt;property name="javax.persistence.schema-generation.scripts.create-target" value="create.sql"/&gt;
      &lt;property name="javax.persistence.schema-generation.scripts.drop-target" value="delete.sql"/&gt;
  
      &lt;property name="javax.persistence.jdbc.driver" value="org.apache.derby.jdbc.EmbeddedDriver"/&gt;
      &lt;property name="javax.persistence.jdbc.url" value="jdbc:derby:chapter04DB;create=true"/&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p></p>
  
  <p>generated script file:</p>
  
  <pre><code>CREATE TABLE BOOK (ID BIGINT NOT NULL, TITLE VARCHAR(255), PRIMARY KEY (ID))
  CREATE TABLE SEQUENCE (SEQ_NAME VARCHAR(50) NOT NULL, SEQ_COUNT DECIMAL(15), PRIMARY KEY (SEQ_NAME))
  INSERT INTO SEQUENCE(SEQ_NAME, SEQ_COUNT) values ('SEQ_GEN', 0)
  </code></pre>
  
  <hr>
  
  <p><strong>Update</strong>
  After replacing:</p>
  
  <pre><code>&lt;property name="javax.persistence.schema-generation-action" value="drop-and-create"/&gt;
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>&lt;property name="javax.persistence.schema-generation.database.action" value="drop-and-create"/&gt;
  </code></pre>
  
  <p>I can 'normally' run app (with exit code 0).</p>
  
  <p><strong><em>But</em></strong> I still take this weird message while first run (with absent DB).  </p>
  
  <p><a href="https://i.stack.imgur.com/1hlUq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/1hlUq.png" alt="enter image description here"></a>
  the second run is clear - no such messages.</p>