Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-3940

ServiceBuilder : isNew() method on a generated entity does not work as expected:

    Details

      Description

      ServiceBuilder : isNew() method on a generated entity does not work as expected:

      long id = CounterLocalServiceUtil.increment();
      MyEntity entity = MyEntityLocalServiceUtil.createMyEntity(id);

      if (entity.isNew()) {
      MyEntityLocalServiceUtil.addMyEntity(entity);
      } else {
      MyEntityLocalServiceUtil.updateMyEntity(entity);
      }

      The check entity.isNew() does not return true.

      This is because in the generated ClpSerializer.java the public static Object translateInput(BaseModel oldModel) and public static Object translateOutput(BaseModel oldModel) methods do not copy the isNew property, only the other properties.

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                8 years, 47 weeks, 3 days ago