Thursday, March 14, 2013

Spring Roo commands - Database setup

Spring Roo is a next-generation rapid application development tool for Java developers. Developing domain models for application with support of Hibernate or any other provider is very easy. I was planning to explain different commands and purpose further post. This post is for simply database setup.

I believe you have setup of Spring Roo tool or STS editor which supports Spring Roo. If not please download and install it from here - http://www.springsource.org/spring-roo.

Then create a new Spring/Spring Roo project. Refer this tutorial for more information - http://static.springsource.org/spring-roo/reference/html/beginning.html

Now coming back to database setup, I generally use hibernate, so here is the command to create  Hibernate provider for database PostgreSQL with username, password, database name and host name which i provide on the command. command which looks like this

roo> jpa setup --provider HIBERNATE --database POSTGRES --hostName localhost --userName user --password password --databaseName foo

If you want to change the provider, database. you can do it easily. For instance if your opted database is  MySQL then change the part command like --database MYSQL

After the execution of this command, Config files and postgres artifacts for database support will be created automatically. Further post, I'll give more details about how to create a model, fields for the model and relations.

No comments:

Post a Comment