This scenario was chosen to allow direct comparison to Vladimir Pavlov's excellent CE102 JEE5 tutorial scenario. Unfortunately, I don't think anyone besides SAP employees has access to the materials. I'll have to contact Vladimir and see if I can persuade him to publish the CE102 handouts so readers can compare the two.
The CE102 sample scenario involves creating a sales order application. In that tutorial, you spend quite a bit of time manually creating and configuring your database tables and EJBs. Developing the application is therefore much faster to do using Composition on Grails than it is using standard JEE5, but standard JEE would win in terms of raw performance and scalability. This is just a tradeoff; it's not to say that Composition on Grails is unusable, or that JEE5 development is impossibly slow and difficult.
|To allow your data to persist in your database even after applications have been reloaded, install your preferred database driver to C:\workspace\grails-1.0\lib. Run generateDeployable.bat again, so that an updated grails.sda (including the new libraries) is generated. This newly generated grails.sda then needs to be deployed with NWDS before running any CoGs application.|
Edit the DevelopmentDataSource.groovy file (located in C:\workspace\grails-1.0\cog-apps\SalesTables\grails-app\conf) with your database specific information and tell grails to update the database. If you're using MySQL, the file might look like this (include quotes):
- Go to the Grails folder C:\workspace\grails1.0.
- Run RunMeFirst.bat. This should open a command prompt in C:\workspace\grails1.0\cog-apps folder. Alternatively, you can use "External Tools" in Eclipse for running grails commands instead of using the command prompt.
Don't close the command prompt as you have to use it for entering commands throughout the tutorial.
- Create a Composition on Grails application.
- Create a domain class. Each class will correspond to a table in your database.
- With the text editor of your choice, open the domain class Customer that you created. You'll find it in grails workspace\cog-apps\SalesTables\grails-app\domain. The constraint "nullable" is set to true to indicate that an attribute may be left blank when creating a new Customer in the table.
Since we're using grails, an ID is automatically created for every object.
- Now edit the SalesOrder class that you created.
- Go back to command prompt and generate the webdynpro controllers and views.
- Generate dev.html.
- Click on dev.html (in workspace\cog-apps\SalesTables) to see your application.