I am exporting the class file from grails in java.but it doesn't working for me.is this is possible to do or not?? if yes then how??
Its a simple groovy service file. Bookservice.groovy
package com.compnyname.testingJar
class BookService {
List<Book> getallBooks(String name){
List<Book> bookList= Book.findAllByName(name);
return bookList;
}
}
Book.groovy(Domain class)
package com.compnyname.testingJar
class Book {
String name;
String description;
static constraints = {
}
}
java file in which i am using this service is as follows
import com.compnyname.testingJar.*;
public List<Groups> listGroup() {
List<Groups> groups = null;
try {
BookService bService = new BookService();
logger.debug("class of bookservice is" + bService.getClass());
List<Book> books = bService.getallBooks("xyz");
logger.debug("List of books is" + books);
groups = sessionFactoryHibernate.getCurrentSession().createQuery("from Groups").list();
} catch (Exception e) {
e.printStackTrace();
}
return groups;
}