Create a non-lazy service
Enabling Jdbc for
User
domain classpackage crew
import grails.compiler.GrailsCompileStatic
import org.taack.User
import javax.annotation.PostConstruct
import static taack.base.TaackJdbcService.Jdbc
@GrailsCompileStatic
class CrewJdbcService {
static lazyInit = false (1)
@PostConstruct (2)
private static void init() {
def u = new User()
Jdbc.registerClass(User,
u.username_, u.mail_,
u.subsidiary_, u.firstName_,
u.lastName_, u.businessUnit_,
u.enabled_) (3)
}
}
-
The service must not be lazily initialized since it does not need to be injected somewhere
-
Method listing domain class columns available through TQL
-
Step 3 can be repeated for all domain classes