1 Reply Latest reply on Nov 17, 2005 6:27 AM by Emmanuel Bernard

    Date bug ?

    Jens Elkner Apprentice

      I'm using entity beans with a date property:

      @Column(name="edate", nullable=true) // uses java.util.Date
       public Date getDate() { return date; }


      Problem is, that em.merge(entity) and em.find(entity) return different results: E.g:

      2005-11-05 19:59:18,908 DEBUG [SocketServerInvokerThread-141.44.198.37-22:net.mdlug.lugmanager.server.EventBean:248]
      - ###################merge:date=1131145200002
      2005-11-05 19:59:18,917 DEBUG [SocketServerInvokerThread-141.44.198.37-22:net.mdlug.lugmanager.server.EventBean:253]
      - ###################merge:date=1131145200002
      2005-11-05 19:59:19,025 DEBUG [SocketServerInvokerThread-141.44.198.37-22:net.mdlug.lugmanager.server.EventBean:61]
      - ###################em.find id=1 1131145200000
      ...
       public Event merge(Event ec) {
       if (log.isDebugEnabled()) {
       log.debug("###################merge:date="
       + ((ec.getDate() != null) ? ec.getDate().getTime() : ""));
       }
       ec = em.merge(ec);
       if (log.isDebugEnabled()) {
       log.debug("###################merge:date="
       + ((ec.getDate() != null) ? ec.getDate().getTime() : ""));
       }
       return ec;
       }
       public Event getEvent(int id) {
       Event e = em.find(Event.class, id);
       if (log.isDebugEnabled() && e != null) {
       log.debug("###################em.find id=" + id + " "
       + (e.getDate() == null ? "" : e.getDate().getTime()));
       }
       return e;
       }


      So I guess this is a bug, since merge does not return the instance, the state has been merged too ...