-1

I have a very basic application made with Grails with only one class.

class House {
    Float price
    String street

    static constraints = {
    }
}

I want to add the Boolean property called "favorite". So I add it:

class House {
    Float price
    String street
    Boolean favorite

    static constraints = {
    }
}

But when I enter to http://localhost:8080/house/index I get this error:


Error 500: Internal Server Error

URI: /house/index Class: org.h2.jdbc.JdbcSQLException

Message: null

Caused by: Tabla "HOUSE" no encontrada Table "HOUSE" not found; SQL statement: select count(*) as y0_ from house this_ [42102-194]

Around line 13 of grails-app/controllers/inmo/HouseController.groovy

def index(Integer max) {
    params.max = Math.min(max ?: 10, 100)
    respond House.list(params), model:[houseCount:House.count()]
}

So I tried executing generate-controller or generate-all (with or without -force because I don't have important data in the database) but I still get the error.

What shoud I do after modifying the domain?

Roby Sottini
  • 2,117
  • 6
  • 48
  • 88

2 Answers2

1

It sounds like you're trying to update the domain class while the application is running in development mode. Many changes can be made without restarting the server, but some changes such as the structure of Domain objects require the server to be restarted to take effect and will often throw an error. Without knowing what error you're receiving, though, this is just a guess.

Trebla
  • 1,164
  • 1
  • 13
  • 28
0

I would advise to run;

grails clean

in order to clean up your cache.

sebDK
  • 1
  • 1