Announcement Announcement Module
Collapse
No announcement yet.
Loading data through Roo created scaffolding Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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

    Comment


    • #3
      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

      Comment


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

        -Stefan

        Comment

        Working...
        X