ivish
ivish

Reputation: 612

Using multiple dataSources in Grails

I am using Grails 2.4.4. I am trying to configure multiple DataSources by following these Grails docs.

Based on documentation I have added multiple dataSources in DataSource.groovy. Docs say that in domain classes I can specify dataSource by using following statement.

static mapping = {
    datasource 'datasource_name'
} 

Similarly in service class dataSource to be used can be specified as,

static datasource = 'datasource_name' 

But above guidelines assume that domain and service classes are *.groovy classes. My domain and service classes are *.java classes. The syntax in above code samples will give compilation errors in java code.

I would like to know how can I apply these instructions to *.java domain and service class.

Upvotes: 2

Views: 232

Answers (1)

James Kleeh
James Kleeh

Reputation: 12228

It is not possible to use Java for domain classes. You must use Groovy.

Upvotes: 1

Related Questions