title: Why JPA does not generate automatically an id for my rows?
body: <p>I want to use SEQUENCE strategy for automatically generate ids, but i am breaking my head to make it work. I dont know at all why i cant make it happen.</p>
  
  <p>This is what i do.
  First i have an entity:</p>
  
  <pre><code> @Entity
  @SequenceGenerator(name="VlasnikSeq", sequenceName="VLA_SEQ")
  public class Vlasnik implements Serializable {
  
      @Id
      @GeneratedValue(strategy=GenerationType.SEQUENCE, generator="VlasnikSeq")
      private Long id;
      //...
  </code></pre>
  
  <p>in the persistence.xml i have it mapped:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"&gt;
      &lt;persistence-unit name="sampleAplication"&gt;
      &lt;class&gt;entities.Vlasnik&lt;/class&gt;
      &lt;class&gt;entities.Ljubimac&lt;/class&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>When i use eclipses feature for generating tables for entities i get this:</p>
  
  <p><img src="https://i.stack.imgur.com/w9AaN.jpg" alt="enter image description here"></p>
  
  <p>As you can see the tables are created, but there is no SEQUENCE table.
  I also noticed in the console, the following message, while JPA was creating the tables:</p>
  
  <blockquote>
    <p>[EL Warning]: Exception [EclipseLink-4002] (Eclipse Persistence
    Services - 2.3.0.v20110604-r9504):
    org.eclipse.persistence.exceptions.DatabaseException Internal
    Exception: java.sql.SQLSyntaxErrorException: SEQUENCE 'VLA_SEQ' does
    not exist.</p>
  </blockquote>
  
  <p>The next think i do is try to run the app and see if i can create some rows. But when i try to persist something, i get an exception that says:</p>
  
  <blockquote>
    <p>org.apache.derby.client.am.SqlException: SEQUENCE 'VLA_SEQ' does not</p>
  </blockquote>
  
  <p>So i  come to the conclusion that for some reason i need that table, so i go to the database management perspective and i try to execute the following query:</p>
  
  <pre><code>CREATE SEQUENCE VLA_SEQ;
  </code></pre>
  
  <p>But i get the following message:</p>
  
  <blockquote>
    <p>Sequence 'VLA_SEQ' already exists.</p>
  </blockquote>
  
  <p>I am totally confused. I don't know what should i do. I just want to automatically generate the IDs of my entities when a new row is created in the DB.</p>
  
  <p>It is the first time i use glassfish 3.1, in the version 3.0 i dont remember, having this issue, i could even use just @GenneratedValue. 
  Ill appreciate some help.</p>