-
Notifications
You must be signed in to change notification settings - Fork 0
Examples
Christian Meyer edited this page Dec 26, 2020
·
3 revisions
public class MyTestRepo extends CRUDService<TestRecord, Long, TestDomain> {
private DSLContext dslContext;
public MyTestRepo(DSLContext dslContext) {
this.dslContext = dslContext;
}
// create, update, delete, exists and other methods are now available in a typesafe way
public String findNameWhereIsActive() {
return fetchOptionalWhere(TEST.NAME, TEST.NAME::isActive).orElseThrow(() -> new NotFoundException(name + " not found"));
}
}class MyTestRepo(dslContext: DSLContext): CRUDService<TestRecord, Long, TestDomain>(dslContext) {
// create, update, delete, exists and other methods are now available in a typesafe way
fun findNameWhereIsActive(): String {
return fetchOneWhere(TEST.NAME) {
TEST.NAME.isActive()
} ?: throw NotFoundException("$name not found")
}
}