Announcement Announcement Module
No announcement yet.
Ovewriting toString() in entity deletes all *.aj Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Ovewriting toString() in entity deletes all *.aj

    First of all, Which is the right word "overwrite" or "override"? (Please don't reply that override is a method of

    In the meantime I'll use overwrite.

    The point is that if I overwrite the toString() method in an entity, Roo deletes all the *.aj files, and that means that it deletes all the functionality from:

    So I have to copy all the code in these files to the java file (entity) if I donīt want to lose all that code.

  • #2
    Another newbie error (of mine).....
    Roo only deletes all *.aj files if you overwrite toString() in the way it's written in the *_Roo_ToString.aj file, in a static way like:

    public String ZZZClass.toString() {
    StringBuilder sb = new StringBuilder();
    return sb.toString();


    • #3
      Roo will only delete the _Roo_ToString.aj file if you override the toString() method by providing one in the normal .java file.

      If Roo is deleting all the *.aj files, I suspect it's a syntax error in the .java file. When Roo cannot parse a .java file it cannot be sure you really want it to have written any ITDs. It therefore acts conservatively by removing them. After all, it can create them again as soon as the syntax error is removed, the .java can be parsed, and one or more @Roo* annotations therefore read in and treated as a directive to produce an ITD.

      Hope this explanation assists.


      • #4
        And Roo is behaving exactly as you have just explained...
        It was a syntax error ( I wasn't using eclipse IDE), so I didn't see it clearly...
        Thanks for the reply...