在Jooq中提取子句
我正在尝试从表中获取值Legal_entity_id(Integer),以便以后使用。
public static int fetchingLegalEntityId() {
return DSL.using(connection).select(LEGAL_ENTITIES.LEGAL_ENTITY_ID)
.from(LEGAL_ENTITIES)
.where(LEGAL_ENTITIES.CODE.eq("someValue"))
.fetchOne();
}
但是我有不兼容的类型。 我需要做什么?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
产生
记录
。 有很多方法可以在许多方法中获取数据jooq 。我可以推荐各种选项,包括:
fetchoptional()。映射(record :: value1).orelsethrow(...)
fetchone(lage_entities.legal_entity_id)
dslContext 。
只需探索JOOQ API(例如,使用IDE并自动完成您的
fetch()
调用以查看可用的内容),然后选择您喜欢的样式。ResultQuery.fetchOne()
produces aRecord
. There are many many ways to fetch data in jOOQ.I could recommend various options, including:
fetchOptional().map(Record::value1).orElseThrow(...)
fetchOne(LEGAL_ENTITIES.LEGAL_ENTITY_ID)
DSLContext.fetchValue(select)
There isn't a best way to do such a query. Just explore the jOOQ API (e.g. by using an IDE and auto-completing your
fetch()
call to see what's available), and pick the style you prefer.