Reputation: 1214
We are creating a Grails app to get the benefit of controller/view features such as gsp layout and view templating, asset-pipeline, LESS CSS compilation, JavaScript and CSS concatenation and minification. However, because of Hibernate difficulties with complex query structures, we have been forbidden by management to use the Grail domain models and GORM. Our approach then has been to write Java DAO services to access the Oracle DB, then access the data objects from Grail controllers and deliver as JSON objects to the view. We are having difficulty finding examples of how to access the data in the controllers.
Upvotes: 0
Views: 595
Reputation: 20699
define your Java DAOs as Spring beans
in conf/spring/resources.groovy[or .xml]
:
beans = {
myComplexDAOOne MyComplexDAOOne
daoTwo DaoTwo
}
then you should be able to access them per autowiring
in a controller or any other Grails artefact
:
class MyController {
def myComplexDAOOne
def daoTwo
def index(){
def res = myComplexDAOOne.someMethod()
[ res:res ]
}
}
Upvotes: 1