Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: How to update fields/relationships/entities afterwards

  1. #1
    Join Date
    Nov 2009
    Posts
    7

    Default How to update fields/relationships/entities afterwards

    Hi,

    I am discovering Roo at the moment and everything seem great!

    I have a question though: how can we update actions done earlier through Roo? More specifically, how to update aspects with Roo?

    For example I do that first:

    Code:
    field --fieldName lastname --class Employee
    But then I want to change lastname to lastName and cascading this change to every aspects generated by Roo, how can we do that?

  2. #2
    Join Date
    Sep 2009
    Posts
    13

    Default

    If the Roo Shell is open for your project, just change the field name directly in the java source code.

    Roo will detect that the file has changed, and will cascade the changes.

  3. #3
    Join Date
    Nov 2009
    Posts
    7

    Default

    Ok damnly simple... But then in the same vein if I deleted something by error (some jsp files for example) how can I regenerate them?

  4. #4
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Indeed, the regeneration of some Web artifacts needs some better handling. At the moment you could simply delete the controller as well and then just issue the 'controller scaffold' command again for the entity you want to provide scaffolding for.

    Cheers,
    Stefan

  5. #5
    Join Date
    Oct 2005
    Location
    Amsterdam
    Posts
    123

    Default

    Quote Originally Posted by Stefan Schmidt View Post
    Indeed, the regeneration of some Web artifacts needs some better handling. At the moment you could simply delete the controller as well and then just issue the 'controller scaffold' command again for the entity you want to provide scaffolding for.

    Cheers,
    Stefan
    I did just that:
    -1. deleted my scaffolded controller, roo shell noticed
    -2. deleted my views for it
    -3. added two fields
    -4. reissued controller scaffold for the entity

    However the new fields are not showing up in the edit form. They are however displayed in show.jsp

    Any guesses?
    Last edited by mirror303; Dec 20th, 2009 at 04:00 AM. Reason: added note about show.jsp
    Hans Westerbeek
    Software Engineer

  6. #6
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Which version of Roo are you using? Please try out Roo RC4 and take a look at the upgrade section in the included documentation where we describe which artifacts to delete and which commands to issue. If you still have issues, I would be very interested in some more details so we can replicate your problem and fix it .

    Cheers,
    Stefan

  7. #7
    Join Date
    Oct 2005
    Location
    Amsterdam
    Posts
    123

    Default

    Hi Stefan,

    My app (just a prototype for now) was created with RC4. I got started with RC3, carefully recorded my commands so i was able to just replay the script. I hadn't really done any programming yet myself so upgrading was really easy, i just discarded my old project

    I went through the information in the upgrade section of the manual as you said and could not find anything that applies to my situation.

    So I suppose you want to get more info from me? Basically my case was like this:

    The domain class is called Customer, the two fields I added are called shippingAddress and billingAddress are simple strings, with notNull, sizeMin and sizeMax defined. I manually modified the class to implement Serializable.

    This is all I can think of right now...
    Hans Westerbeek
    Software Engineer

  8. #8
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Can you please share the exact steps you did so I can replicate your issue. A step by step guide would help here. It would be good if you can also share your script.

    Cheers,
    Stefan

  9. #9
    Join Date
    Apr 2008
    Posts
    151

    Default

    If I read between the lines, I think there is a feature request in here --

    Roo command history per project, that can be dumped and sent back for bug reports

  10. #10
    Join Date
    Mar 2008
    Location
    Sydney, AU
    Posts
    974

    Default

    Quote Originally Posted by Jabberz View Post
    If I read between the lines, I think there is a feature request in here --

    Roo command history per project, that can be dumped and sent back for bug reports
    In fact that (much requested) feature already exists . Sorry I have not made this clear. When issuing commands in Roo RC4 it will create a log.roo file in the root of your project and that contains all commands you have issued. So if you start the Roo shell and then type 'backup' a zip archive will be created which contains that script. So all you have to do is to send me the zip file.

    However, I would also need to know what steps you have taken outside the roo shell (changed java files (Serializable, etc)) and in which exact sequence you have taken these steps (ie. first I ran the attached script, then I added two fields in the Entities Java source, which should have updated the view artifacts). Also, it would be good to know if the Roo shell indicated any problems (ie errors, rollbacks etc). You can also run Roo shell in 'development mode' which will actually give you stack traces, etc.

    Cheers,
    Stefan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •