3

I created an entity called Card and its CardController. Since I committed an error when creating them, I deleted both and created the Card entity again.

The problem happens when I execute the following command to get the Controller back with the new Card fields:

web mvc all

Roo output is:

Found existing controller for mapping '/cards'.
Created SRC_MAIN_JAVA\com\entities\CardController.java

and when executed the /cards path I keep seeing the OLD fields. Moreover, if I remove the controller again (I've tried both in STS and directly from the filesystem) and I try this:

web mvc scaffold --class com.web.CardController --backingType com.entities.Card

the output keeps being:

Found existing controller for mapping '/cards'.
Created SRC_MAIN_JAVA\com\entities\CardController.java

So the question is: where is Roo finding the controller for /cards and why, if it has found it, it creates it again in the wrong old package?

skaffman
  • 398,947
  • 96
  • 818
  • 769
miguel perher
  • 901
  • 1
  • 8
  • 17
  • Take a look at this question: http://stackoverflow.com/questions/2641037/springsource-roo-controller-removal – nowaq Dec 13 '11 at 09:00

2 Answers2

0

I made a similar error and discovered how to fix it.

In roo, I used web mvc all com.example.project.domain, followed by web mvc all, and due to my mistake, roo put the controllers for my entities in the domain folder. Next, I used web mvc all com.example.project.web, and roo added any subsequent entity controllers under the web folder. Unfortunately, if I removed and re-added the early entities, then roo continued to put those back under the domain folder.

I fixed it by using the web mvc scaffold command for each problematic entity, like this: web mvc scaffold --class ~.domain.MyEntity --backingType ~.web.MyEntityController. After that, even web mvc all continued to work correctly.

mvanlamz
  • 91
  • 1
  • 3
0

from what i can see you are adding the controller into the entities instead of web

delete the entity and the .aj files that are relevant, the java controller, the .aj controller, go into the database and drop the table for the entity, then recreate the entity and the controller

adam2510
  • 563
  • 1
  • 7
  • 22
  • I'm trying to create the controller into `web`, but there's some hidden config that everytime I try it makes the controller to be created in the `entities`, where it was originally created (and deleted). Removing all those things you say doesn't match with the simplicity that Roo claims to provide :-( – miguel perher Nov 14 '11 at 17:02