2 Replies Latest reply on Nov 28, 2005 9:52 AM by Ruud van Kersbergen

    detach on purpose

    Ruud van Kersbergen Newbie

      I wrote a comparator that compares to objects and returns a hashtable of the attributes that are different.

      @Stateless
      @Local ({Configuration.class})
      @Remote ({RemoteConfiguration.class})
      public class ConfigurationBean
      .....
      public Device modDevice (Device dev) ...
      Device dbDev = getDeviceByKey(dev.getId());
      em.merge(dev);

      change some other stuff in dbDev....... that also needs to be written to the logger

      call the comparator to write to a log file (dev, dbDev)

      The detached dev contains ONLY the change attributes.
      after the merge the dev is also attached and ALL attributes are identicall to the attributes in dbDev.

      Does anybody know how to detach an object on purpose ? Serializig forces detaching. So calling another bean or using ObjectOutputStream can maybe solve it, but it think there must be a clear way.

      Please help.