7 Replies Latest reply on Aug 27, 2009 9:42 PM by Srinivas Chamarthi

    Are Transient Fields empty in @PreUpdate functions?

    Marc Newbie

      My class 'EEntity' has a transient field 'entityType' which
      is required by function 'EEntity.updatePropertiesAndFields()'.
      This function is called before persisting or updating an EEntity object.

      This works fine for a 'PrePersist' operation. However when changing
      the object in the GUI and performing a 'merge' the transient field
      'entityType' has lost its value.

      (see source code)
      I check in the session-bean before calling 'em.merge', the type is 'Purchase Order':

      2006-01-30 00:53:16,000 INFO [STDOUT] 30-Jan-2006 00:53:16 common.util.ELogger debug
      SEVERE: mergeEntity: entityType is :Purchase Order

      I check in the @PreUpdate function and the type is empty:

      2006-01-30 00:53:16,031 INFO [STDOUT] 30-Jan-2006 00:53:16 common.util.ELogger severe

      SEVERE: updateProperties: entityType is empty: 17401-110

      Am I missing something or are all transient fields empty in @PreUpdate functions ???

      Any help would be well appreciated,


      public class EInstanceManagerBean implements EInstanceManager, EInstanceManagerRemote, Serializable {

      @PersistenceContext(unitName = "ngerp")
      protected EntityManager em;

      public void mergeEntity(EEntity entity) {

      ELogger.severe("mergeEntity: entityType is empty"+entity.getDescription());
      } else {
      ELogger.debug("mergeEntity: entityType is :" +entity.getEntityType().getDescription());


      @Entity(access = AccessType.FIELD)
      @Inheritance(strategy = InheritanceType.SINGLE_TABLE, discriminatorType = DiscriminatorType.STRING, discriminatorValue = "E")
      public class EEntity implements Serializable

      private EEntityType entityType;


      private void updatePropertiesAndFields()
      ELogger.severe("updateProperties: entityType is empty: "+this.getDescription());
      } else {
      ELogger.debug("updateProperties: entityType is: " +this.getEntityType().getDescription());