Announcement Announcement Module
No announcement yet.
GWT: How to add save logic? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • GWT: How to add save logic?

    I am trying to add some simple save logic to my Tour entity. I want to update a timestamp (updatedOn) whenever the object is persisted. I tried to pull up the persist() from the .aj to the .java so I could add the logic to the persist(). But when I saved the .java, Roo removed the persist() from causing a compile error on TourActivitiesMapper.

    Am I going about this the wrong way or is this a bug?


  • #2
    After working with this some more, this appears to be a bug to me, so I created Jira ROO-2379.


    • #3
      Roo is very picky about any of it's managed files you may try to edit. I think many people are waiting for an update which will allow developers to add to roo managed files. You have to move around managed files to add dynamic finder functionality to GWT, as well as any other kind of edits you would want to do.

      In the mean time you could create a work around by making a function in your Entity class such as "persistAndTimeStamp()" which simply updates a time field and then calls persist().

      Then you need to add it to your so it calls your function instead of persist. The only issue is that this is also managed by roo. So you need to move that class to an unmanged package before you can successfully edit it or roo will just overwrite your edits.

      Hope this helps.