title: Object persistence doesn't work
body: <p>I'm trying to implement a little chat with JPA. Everythings work except one thing. I want, when my user open the connection with the endPoint, save his room number, his nickname and the timstamp.
  My table has been well created, columns too but i cant persist my Connexion Object in DataBase. </p>
  
  <p>I'm using Glasfish 4.0 and i've already create my JDBCRessources and JDBC Connection pools who are worked well.</p>
  
  <p>Here my ChatEndPoint.Java</p>
  
  <pre><code>package server;
  
  import java.io.IOException;
  
  import javax.websocket.EncodeException;
  import javax.websocket.EndpointConfig;
  import javax.websocket.OnMessage;
  import javax.websocket.OnOpen;
  import javax.websocket.Session;
  import javax.websocket.server.PathParam;
  import javax.websocket.server.ServerEndpoint;
  
      @ServerEndpoint(value = "/websocket/{room-name}/{nick-name}", encoders = { ChatMessageEncoder.class }, decoders = { ChatMessageDecoder.class })
      public class ChatEndPoint {
  
          // traitement de la connexion d'un client
          @OnOpen
          public void open(Session session, EndpointConfig conf, @PathParam("room-name") String roomName, @PathParam("nick-name") String nickName) throws Exception {
              System.out.println("connection ouverte");
              session.getUserProperties().put("salle", roomName);
              DAO dao=new DAO();
              dao.createConnection(nickName, roomName);
  
          }
  
          // traitement de la reception d'un message client
          @OnMessage
          public void onMessage(Session session, ChatMessage msg) throws IOException,
                  EncodeException {
  
              if (msg instanceof ChatMessage) {
  
                  ChatMessage reponse = new ChatMessage(msg.getEmetteur(),
                          msg.getSalle(), msg.getMessage());
  
                  for (Session sess : session.getOpenSessions()) {
                      if (sess.isOpen()
                              &amp;&amp; sess.getUserProperties().get("salle")
                                      .equals(msg.getSalle()))
                          sess.getBasicRemote().sendObject(reponse);
                  }
  
              }
  
          }
      }
  </code></pre>
  
  <blockquote>
    <p>My Connexion class who represent my entity to save :</p>
    
    <p>Connexion.java</p>
  </blockquote>
  
  <pre><code>package server;
  
  import java.io.Serializable;
  import java.sql.Timestamp;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.GenerationType;
  import javax.persistence.Id;
  import javax.validation.constraints.NotNull;
  
  
  @Entity
  public class Connexion implements Serializable {
  
      private static final long serialVersionUID = 1L;
  
      @Id
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @NotNull
      @Column( name = "nickName" )
      protected  String nickName;
  
      @NotNull
      @Column( name = "roomName" )
      protected  String roomName;
  
      @Column( name = "dateConnexion" )
      protected  Timestamp connectionDate;
  
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getNickName() {
          return nickName;
      }
  
      public void setNickName(String nickName) {
          this.nickName = nickName;
      }
  
      public String getRoomName() {
          return roomName;
      }
  
      public void setRoomName(String roomName) {
          this.roomName = roomName;
      }
  
      public Timestamp getConnectionDate() {
          return connectionDate;
      }
  
      public void setConnectionDate(Timestamp timestamp) {
          this.connectionDate = timestamp;
      }
  }
  </code></pre>
  
  <blockquote>
    <p>DAO.java</p>
  </blockquote>
  
  <pre><code>package server;
  
  import java.sql.Timestamp;
  
  import javax.ejb.LocalBean;
  import javax.ejb.Stateful;
  import javax.ejb.Stateless;
  import javax.persistence.EntityManager;
  import javax.persistence.EntityManagerFactory;
  import javax.persistence.Persistence;
  import javax.persistence.PersistenceContext;
  import javax.persistence.PersistenceUnit;
  
  
  @Stateless
  @LocalBean
  public class DAO {
  
      @PersistenceUnit
      private EntityManagerFactory emf;
  
      // Injection du manager, qui s'occupe de la connexion avec la BDD
      @PersistenceContext(unitName="projetwebee1")
      EntityManager em;
  
  
  
      // Enregistrement d'un nouvel utilisateur
      public void createConnection(String nickName, String roomName) throws Exception{
          this.emf=Persistence.createEntityManagerFactory("projetwebee1");
          this.em = this.emf.createEntityManager();
  
          Connexion c = new Connexion();
          c.setNickName(nickName);
          c.setRoomName(roomName);
          c.setConnectionDate(new Timestamp((new java.util.Date()).getTime()));
          System.out.println(" "+em);
          em.persist(c);
          System.out.println("persist OK");
  
      }
  }
  </code></pre>
  
  <blockquote>
    <p>persistence.xml generated by JPA. But i edited some part of it </p>
  </blockquote>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence version="2.1"
      xmlns="http://xmlns.jcp.org/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_1.xsd"&gt;
      &lt;persistence-unit name="projetwebee1" transaction-type="JTA"&gt;
          &lt;jta-data-source&gt;JEEProjectJNDIFinal3&lt;/jta-data-source&gt;
          &lt;properties&gt;
              &lt;property name="eclipselink.ddl-generation" value="create-tables" /&gt;
  
          &lt;/properties&gt;
  
  
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt;
  </code></pre>
  
  <p>So after i'm trying to persist my entity i cant see it in my data Explorer. I've already try a lot of other method than i found on the official doc or even here. But no one succeed.</p>
  
  <p>Thanks for your help </p>