Search code examples
grailsgrails-orm

Grails GORM Extend Generic Interface


I'm unable to create a generic data service interface and have data services implement it. e.g:

interface DataServiceContract<T> {
    T get(Serializable id)
    T update(@NotNull Serializable id, @NotNull T obj)
    List<T> list()
    T save(@NotNull T t)
    void delete(Serializable id)
}

With the following implementation:

@Service(Book)
abstract class BookService implements DataServiceContract<Book>{
    abstract Book findByName(String name)
}

I end up with:

Error:(6, 2) Groovyc: No implementations possible for method 'java.lang.Object get(java.io.Serializable)'. Please use an abstract class instead and provide an implementation.

Is this just not possible within framework? Otherwise, how I can share operations between dataservices?


Solution

  • Is this just not possible within framework?

    There are no versions of the framework that support that.