title: Problems with java @GeneratedValue (strategy = GenerationType.IDENTITY) using MariaDB 10.4 and eclipselink
body: <p>I am developing a REST web service in Java EE I am using: Glassfish 5.0 (build 25), MariaDB 10.4 and eclipselink (JPA 2.1)
  here is my code:</p>
  
  <h2>commande_line table</h2>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `cooldb`.`commande_line` (
    `id` INT NOT NULL AUTO_INCREMENT,
    `quantity` INT NULL,
    `discount` INT NULL,
    `dish` INT NOT NULL,
    `commande` INT NOT NULL,
    PRIMARY KEY (`id`),
    UNIQUE INDEX `id_UNIQUE` (`id` ASC),
    INDEX `fk_commande_line_dish1_idx` (`dish` ASC),
    INDEX `fk_commande_line_commande1_idx` (`commande` ASC),
    CONSTRAINT `fk_commande_line_dish1`
      FOREIGN KEY (`dish`)
      REFERENCES `cooldb`.`dish` (`id`)
      ON DELETE CASCADE
      ON UPDATE CASCADE,
    CONSTRAINT `fk_commande_line_commande1`
      FOREIGN KEY (`commande`)
      REFERENCES `cooldb`.`commande` (`id`)
      ON DELETE CASCADE
      ON UPDATE CASCADE)
  ENGINE = InnoDB
  DEFAULT CHARACTER SET = utf8;
  </code></pre>
  
  <h2>persistance.xml</h2>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.2" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_2.xsd"&gt;
    &lt;!-- Define Persistence Unit --&gt;
    &lt;persistence-unit name="my_persistence_unit" transaction-type="JTA"&gt;
      &lt;jta-data-source&gt;jdbc/mariadb&lt;/jta-data-source&gt;
      &lt;class&gt;com.yac.model.Address&lt;/class&gt;
      &lt;class&gt;com.yac.model.Commande&lt;/class&gt;
      &lt;class&gt;com.yac.model.CommandeLine&lt;/class&gt;
      &lt;class&gt;com.yac.model.Dish&lt;/class&gt;
      &lt;class&gt;com.yac.model.Dishtype&lt;/class&gt;
      &lt;class&gt;com.yac.model.Ingredient&lt;/class&gt;
      &lt;class&gt;com.yac.model.Payement&lt;/class&gt;
      &lt;class&gt;com.yac.model.Profil&lt;/class&gt;
      &lt;class&gt;com.yac.model.Restaurant&lt;/class&gt;
      &lt;class&gt;com.yac.model.Userapp&lt;/class&gt;
      &lt;exclude-unlisted-classes&gt;true&lt;/exclude-unlisted-classes&gt;
      &lt;properties&gt;
      &lt;/properties&gt;
    &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <h2>commandeline entity</h2>
  
  <pre><code>public class CommandeLine implements Serializable {
  
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      @Basic(optional = false)
      @Column(name = "id")
      private Integer id;
      @Column(name = "quantity")
      private Integer quantity;
      @Column(name = "discount")
      private Integer discount;
      @JoinColumn(name = "commande", referencedColumnName = "id")
      @ManyToOne(optional = false)
      private Commande commande;
      @JoinColumn(name = "dish", referencedColumnName = "id")
      @ManyToOne(optional = false)
      private Dish dish;
      //Constructor
      // Setter and Getter
  }
  </code></pre>
  
  <h2>commandeline web service</h2>
  
  <pre><code>@Stateless
  @Path("commandeline")
  public class CommandeLineFacadeREST extends AbstractFacade&lt;CommandeLine&gt; {
  
      @PersistenceContext(unitName = "my_persistence_unit")
      private EntityManager em;
  
      public CommandeLineFacadeREST() {
          super(CommandeLine.class);
      }
  
      @POST
      @Override
      @Consumes(MediaType.APPLICATION_JSON)
      public void create(CommandeLine entity) {
          super.create(entity);
      }
  
      @Override
      protected EntityManager getEntityManager() {
          return em;
      }
  }
  </code></pre>
  
  <h2>AbstractFacade</h2>
  
  <pre><code>public abstract class AbstractFacade&lt;T&gt; {
  
      private Class&lt;T&gt; entityClass;
  
      public AbstractFacade(Class&lt;T&gt; entityClass) {
          this.entityClass = entityClass;
      }
  
      protected abstract EntityManager getEntityManager();
  
      public void create(T entity) {
          getEntityManager().persist(entity);
      }
  }
  </code></pre>
  
  <p>The problem is when I test my web service with Postman and I try to insert a record with a POST request
  here is what I receive as error message:</p>
  
  <pre><code>Local Exception Stack: 
  Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.7.0.v20170811-d680af5): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: java.sql.SQLSyntaxErrorException: (conn=158) Table 'cooldb.sequence' doesn't exist
  Error Code: 1146
  Call: UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?
      bind =&gt; [2 parameters bound]
  Query: DataModifyQuery(name="SEQ_GEN_SEQUENCE" sql="UPDATE SEQUENCE SET SEQ_COUNT = SEQ_COUNT + ? WHERE SEQ_NAME = ?") ...
  </code></pre>
  
  <p>I don't understand why the problem with SEQUANCE when I use @GeneratedValue (strategy = GenerationType.IDENTITY).
  When I change with @GeneratedValue (strategy = GenerationType.SEQUENCE) and I create the table with the following script:</p>
  
  <pre><code>CREATE SEQUENCE SEQUANCE START WITH 1 INCREMENT BY 1;
  </code></pre>
  
  <p>by applying the solution shown in : <a href="https://stackoverflow.com/questions/23141014/table-customerjpa-sequence-doesnt-exist-jpa">Table &#39;customerjpa.sequence&#39; doesn&#39;t exist JPA</a>
  but the same probleme</p>
  
  <p>thank you in advance for your help.</p>