Results 1 to 4 of 4

Thread: Loading data through Roo created scaffolding

  1. #1

    Default Loading data through Roo created scaffolding

    I created the Roo persistence scaffolding for a domain I am working on. I need to populate the database using this scaffolding (the data to be populated is currently in a bunch of XML files). Can someone provide a quick example on how to start this? A simple Java "main" that populates a single table will help me get started. I am not looking for reading the files, just how to access the Roo entities from outside of the MVC controllers.
    Any help is appreciated.
    Regards,
    Raj

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

    Default

    Spring 3 has support for scripts that can be loaded for embedded databases. I am not sure if that fits your use case exactly but it may serve as a good starting point.

    Also, if you are using a database like MySql there are usually options to import the data from various sources (SQL, CSV, XML, Excel, etc).

    Another option is to create a little bean which reads the XML files at start time and populates the contents to the DB.

    HTH,
    Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

  3. #3

    Default

    Stefan,
    Thanks for the information. I took a simpler approach by writing a command line application and loading the Spring application context file and using the Roo created entities to load the database. Seems to be working fine.
    Regards,
    Raj

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

    Default

    Yes that is another option indeed. This shows the power of Roo since it gives you the full power of Spring.

    -Stefan
    Stefan Schmidt
    Software Engineer, Spring Roo
    SpringSource - a division of VMware
    twitter @schmidtstefan

Tags for this Thread

Posting Permissions

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