How to translate Roo2 script to Roo1?

62 views Asked by At

There are a good 10-lines script for test and demo Spring Roo, that is working fine with Roo v2.0.0.M3... But I want to run it with Roo v1.3.X.

The complete tutorial is here at Github.

I suppose that I translated correctly the roo2 command "project setup --topLevelPackage" to roo1's "project --topLevelPackage"... But,

  • How to translate roo2's repository jpa --all command?

  • and how to translate the rest of the roo2 script showed below?

    service --all web mvc setup web mvc view setup --type THYMELEAF web mvc controller --all --responseType THYMELEAF web mvc controller --all --pathPrefix /api

1

There are 1 answers

0
jcgarcia On

Remember that Spring Roo 2.x is not backward compatible with Spring Roo 1.x so there are some commands and features that doesn't exists in Spring Roo 1.x and there are some features that exists in 1.x but doesn't exists in 2.x.

In the case of the access data, Spring Roo 1.x manages the data access layer using ActiveRecord. However, in Spring Roo 2.x the data access layer uses Spring Data Repositories. So in Spring Roo 1.x there's not an equivalent to repository jpa command. So just create an entity and you will have all the necessary methods to make CRUD.

The same case with service and THYMELEAF view. Spring Roo 1.x doesn't generates service layer. Controllers uses entitiy methods directly to access to the database. Also, all the business logic have been implemented in controllers directly. Related with THYMELEAF and view commands, in Spring Roo 1.x doesn't exists the possibility to select a different type of view. JSP was the default view. So just create a controller related with the created entity and you'll have a controller and a jsp view to manage the entity in a web browser.

But DON'T WORRY. You have a lot of examples about the commands you should use with Spring Roo 1.x. Just follow these steps:

In that folder you can see a lot of .roo scripts that contains a lot of commands used in that version.

As always, you could read the Spring Roo reference documentation for Spring Roo 1.3.2 here http://docs.spring.io/spring-roo/docs/1.3.2.RELEASE/reference/html/

Hope it helps,