I have the following domain class that I need to map to a specific datasource (oracle), while all other my domain classes are mapped to the default dataSource (mysql, which works perfectly).
My editor is GGTS and as you can notice "datasource" inside mapping appears underlined, as if it were not a valid property inside mapping:
I also built a simple controller:
class AccountWfmController {
def index() {
render AccountWfm.list() as JSON
}
}
when trying to call the controller method index
, I get the following exception:
java.lang.IllegalStateException
Method on class [mypackage.AccountWfm] was used outside of a Grails application. If running in the context of a test using the mocking API or bootstrap Grails correctly.
Finally, my datasource (note: in my /lib
folder I have ojdbc6.jar
):
dataSourceWFM {
pooled = true
dialect = org.hibernate.dialect.Oracle10gDialect
driverClassName = 'oracle.jdbc.OracleDriver'
username = "username"
password = "password"
url = "jdbc:oracle:thin:@192.168.1.1:1521:SID"
dbCreate = '' //none, I have readonly access
}
any hints on what is happening here (Grails 2.4.3)?
Thanks