How can I Include Grails generated java class into the grails project?
How can I use the generated class by grails into a java class in the project. Use my Groovy class into a Java class of the Grails project. Accesing his methods, attributes, etc...
Example:
I have a Domain class like this:
package es.prueba.domain
class Author implements Serializable {
String firstName
String lastName
static hasMany = [books: Book]
def relatesToMany = [ books : Book ]
SortedSet books
static constraints = {
books(nullable: true)
}
}
I want to use it in a Java File. In my case I'm using GWT to send objects with the service AuthorService.groovy
.
I generated the interfaces with rule: grails generate-gwt-rpc
BookService:
package org.example.client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface BookService extends RemoteService {
es.prueba.domain.Author getAuthor(int arg0);
}
BookServiceAsync:
package org.example.client;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface BookServiceAsync {
void getAuthor(int arg0, AsyncCallback callback);
}
But I get the exception:
No source code is available for type es.prueba.domain.Author; did you forget to inherit a required module?
When I run the app with: grails run-app
command.
How can I include source in the project?
Thank you.