Tuesday, August 21, 2012

SPRING Roo commands



// open eclipse with spring roo installation
// springsource -> sts-2.9.2.RELEASE -> STS.sh
// script --file /home/meena/Desktop/meena/my_spring_roo/spring_roo_commands.roo


// setting up database provider
jpa setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY

jpa setup --provider HIBERNATE --database MYSQL --databaseName myDb--hostName 123.1.1.9 --userName user1--password pass@123


// creating class in roo proj
entity jpa --class ~.MyClass

entity jpa --class ~.master.domain.Lov --identifierColumn LOV_PK --identifierField LovPk --table LM_LOV

// declare variables in class
field string --fieldName message --notNull
field boolean --fieldName ActiveYN --column LOV_ACTIVE_YN

// creates .war file of proj
web mvc setup

// building all source files in mypkg
web mvc all --package mypkg


// create class with roo annotations to include toString() automatically for all variables
class --class in.mydomain.Employee --rooAnnotations
field number --fieldName empID --type int --notNull --unique
field string --fieldName empName --notNull

// to give custom name to toString method of a class
// @RooToString(toStringMethod="myTostring")

// to prevent a field from displaying through toString()
// @RooToString(excludeFields={"empName"})

class --class ~.domain.Address --rooAnnotations
field string --fieldName streetName --notNull
field string --fieldName city --notNull
field string --fieldName country --notNull

// to modify instead of recreating or overriding the class definition
focus --class ~.Employee
field other --fieldName empAdd --type in.traccion.Address --notNull
field date --fieldName dateOfBirth --type java.util.Date

// To remove or modify field in class, make changes in IDE

// to create interface
interface --class in.mydomain.MyInterface

// To set up Hibernate as the JPA provider for your application
persistence setup --provider HIBERNATE --database MYSQL --databaseName roodb --username=root password=root

class --class in.traccion.ParentClass1
class --class in.traccion.ChildClass1 --extends ParentClass1

focus --class ~.ParentClass1
field number --fieldName parentid --type int --min 0 --max 1000 --unique
field string --fieldName parentName

focus --class ~.ChildClass1

// roo> database properties list
// database.driverClassName = com.mysql.jdbc.Driver
// database.password = root
// database.url = jdbc:mysql://localhost:3306/roodb
// database.username = root

// to set username of a db
database properties set --key database.username --value root
database properties set --key database.password --value root
database properties set --key database.initialPoolSize --value 10
database properties remove --key database.url
database properties set --key database.modified.url --value jdbc:mysql://localhost:3406/roodb

// Right-click on project in project explorer & select Run as Server

No comments:

Post a Comment