title: Java EE with JPA, strange database generated
body: <p>I'm trying to understand how JPA is working by making some POC on my own.</p>
  
  <p>I've created some entities, who are something like that :</p>
  
  <pre><code>@Entity
  @Table(name = "Employee")
  public class Employee implements Serializable {
  
      @Id
      @GeneratedValue(strategy= GenerationType.IDENTITY)
      private Long id;
  
      private String firstName;
  
      private String lastName;
  
      @ManyToMany
      @JoinTable(name="SKILLS_EMPLOYEES")
      private List&lt;Skill&gt; skills;
  
      @ManyToOne
      private Company company;
  
  
      public Employee() {
      }
  
      public Employee(String firstName, String lastName) {
          this.firstName = firstName;
          this.lastName = lastName;
      }
  
  //[..getters &amp; setters...]
  
      public void addSkill(Skill skill) {
          this.skills.add(skill);
          skill.addEmployee(this);
      }
  
      public void setCompany(Company company) {
          this.company = company;
          this.company.addEmployee(this);
      }
  
  }
  
  
  @Entity
  @Table(name = "Company")
  public class Company implements Serializable {
  
      @Id
      @GeneratedValue(strategy= GenerationType.IDENTITY)
      private Long id;
  
      private String companyName;
  
      private List&lt;Employee&gt; employee;
  
      public Company() {
      }
  
      public Company(String companyName) {
          this.companyName = companyName;
      }
  
  //[..getters &amp; setters...]
  
      public void setEmployee(List&lt;Employee&gt; employee) {
          this.employee = employee;
      }
  
      public void addEmployee(Employee employee) {
          this.employee.add(employee);
      }
  }
  </code></pre>
  
  <p>So, a company can have employees, and an employee can have only one company, but in my database, glasshfish created a table between employee and company.</p>
  
  <p>Employee :</p>
  
  <ul>
  <li>ID</li>
  <li>FIRSTNAME</li>
  <li>LASTNAME</li>
  <li>COMPANY_ID</li>
  </ul>
  
  <p>Company :</p>
  
  <ul>
  <li>ID</li>
  <li>COMPANYNAME</li>
  </ul>
  
  <p>Company_Employee :</p>
  
  <ul>
  <li>Company_ID</li>
  <li>Employee_ID</li>
  </ul>
  
  <p>What did I do wrong ?</p>