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

            Assignee:
            support-lep@liferay.com SE Support
            Reporter:
            sheyenrath Stef Heyenrath (Inactive)
            Participants of an Issue:
            Recent user:
            Esther Sanz
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Days since last comment:
              10 years, 19 weeks, 4 days ago

                Packages

                Version Package