API / Apache Grails Interview questions
Define GORM Data Services?
GORM Data Services, introduced in GORM 6.1, are an alternative to dynamic finders that let a developer declare a data access interface (or abstract class) and have GORM generate the real implementation at compile time, based purely on the method signatures declared.
Writing one is a matter of creating an interface annotated with @grails.gorm.services.Service tied to a domain class, then declaring abstract methods whose names and return types follow the same recognizable patterns as dynamic finders (save, find, list, and so on); GORM's AST transformation reads those signatures and synthesizes a working implementation automatically, without a developer writing the method body by hand.
Because the implementation is generated and checked at compile time rather than resolved dynamically at runtime, mistakes that would only surface as a runtime failure with a dynamic finder are instead caught during the build — alongside other benefits like easier testing (the interface can be mocked normally) and built-in support for multi-tenancy through the @CurrentTenant annotation.
More Related questions...