-
Feb 2nd, 2010, 08:52 AM
#1
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
-
Feb 2nd, 2010, 07:34 PM
#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
-
Feb 3rd, 2010, 09:32 AM
#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
-
Feb 3rd, 2010, 05:10 PM
#4
Yes that is another option indeed. This shows the power of Roo since it gives you the full power of Spring.
-Stefan
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
-
Forum Rules