当前位置:网站首页>jOOQ 3.14 released - SQL/XML and SQL/JSON support
jOOQ 3.14 released - SQL/XML and SQL/JSON support
2022-07-31 13:48:00 【DebugUsery】
jOOQ 3.14已经发布,支持SQL/XML、SQL/JSON、Kotlin代码生成、Embeddable type and domain type、Synthesis of constraint、更好的MERGESupport, and moreSQL转换
在这个版本中,We according to user feedbackgithubThe classification problem,Finally achieved some want the function,Including better Kotlin支持、Embeddable type and domain types support.除此之外,We believe that our new increase ofXML和JSONOperation support will become the futureORM与SQLA leading database interaction game changer
XML和JSON
标准SQL长期以来一直支持SQL/XML,And since the recent,大多数RDBMS也,支持标准SQL/JSONThe specific variant or its suppliers.虽然ORDBMSThe extension of the never be use,但XML和JSONWas obtained using.Once in a while to deal with the standardization of data,And stored in the database directly to the document,是有意义的.然而,This is not our most exciting.
We are all excited about all the fancy operator support,比如:
- JSON_TABLE将JSON值变成SQL表
- JSON_ARRAY, JSON_OBJECT, JSON_VALUEFrom the value of structureJSON数据
- JSON_ARRAYAGG, JSON_OBJECTAGGData aggregation into nestedJSON文档.
- JSON_EXISTSUsed to query aJSON路径的文件.
A similar function can also be used toXML,如XMLTABLE、XMLELEMENT、XMLAGG等.
jOOQ 3.14Support every version of the standardSQL XML和JSON操作符,And where there is non standard support(如PostgreSQL和SQL Server),模拟它们.Commercial version also supportsSQL Server非常方便的FOR XML和FOR JSON APIs,In other places using standard operator to simulate the grammar to see:
但这还不是全部! 如果你在classpath上有Gson、Jackson或JAXB,我们可以使用它将org.jooq.XML、org.jooq.JSON、org.jooq.JSONBType automatic mapping from the result of your query to the nested data structure you see:
These methods are very strong.在很多情况下,你可以跳过,直接将RESTOr similar endpoint is bound tojOOQ / SQL查询,The front end of the produce for youJSON:
支持Kotlin
Some long-term support usScala扩展和ScalaGenerator.KotlinIs a kind of additional very promisingJVM语言,One of the newjOOQ-kotlin模块以及KotlinGenerator将为你的jOOQ/KotlinIntegration of increase a lot of value.KotlinGenerator提供了,除其他事项外:
- 对生成的POJOData classes support
- 对生成的POJO、Interface and record the properties of the support
- Better inefficiencies support
jOOQ-kotlinThe expansion of the module provides some useful function,以进一步改善jOOQ/Kotlin集成的体验:
除了上述内容外,我们还用JetBrains的nullability
Comments to thejOOQ API:
- org.jetbrains.annotations.Nullable
- org.jetbrains.annotations.NotNull
This will eliminate yourKotlin/jOOQIn the code many annoyingT!类型,把它们变成T或T?类型,让你更有信心.通过这些改进,We also strictly examined our existingScalaGenerator,修复了很多bug.
Embeddable type
jOOQ 3.14One of the biggest new features is byJPA的启发,它在,With embedded type.Embedded type is a user-defined types of database(UDT)的模拟,只有Oracle和PostgreSQLTo support this type.The biggest benefit of this type is in your database schema to create more semantic、复合数据类型,And benefit from additional type safety. We explain the function of main is in the source code generator,The output is now become more valuable.所有的jOOQVersion is supported by basic infrastructure,In pattern matching set,And put them into a synthetic embeddable type. 除了上述内容外,Our commercial version also provides automatic configuration
Embeddable type,在这种情况下,They really play a role:
- 对于主/The only foreign key constraints, and its matching
- 对于DOMAIN类型(见下文)
- Processing of overlapping embeddable type
- Embedded type allows to replace its basic column
We take this conceptJPA更进一步.在jOOQ中,Embeddable type can be used as a,As the underlying list view,Instead of replacing them,或者像JPASuch as a replacement.jOOQRespect the relationship model of all levels,包括,Overlap the constraints of the,Allowing two embeddable type overlap. 更多信息,请参考:
DOMAIN类型
When it comes to type,Some database dialect support standardSQL DOMAIN类型,This is a simplerUDTs形式.与其使用像VARCHAR(10)This type of low-level technology,Why not give your single-row type a name,And give them to add some reusableCHECK约束呢? 这就是DOMAIN类型:
- A named type
- On a technical type alias,比如VARCHAR(10)
- 可能会添加一个DEFAULT表达式
- May add aNOT NULL约束条件
- Can add a set ofCHECK约束
Above all content can be in your model reuse,If you have a business,You can even make the code generator for you all areas of the automatic generation of embedded type,以便从JavaAdditional types of security benefit.
欲了解更多信息,请参考:
Synthesis of constraint
Related to the improvement of the code generator output is synthetic objects,As the synthesis of the primary key is used to support,Now also support to synthesize unique key and foreign key. If you are in the database for security and reusable components to invest a lot of,You will use a lot ofSQL视图.不幸的是,View without any metadata like foreign key constraints--Although the metadata database designer is for you "显而易见 "的.Through the synthesis constraint,你可以告诉jOOQYour knowledge of the underlying constraints.
元数据对jOOQMain benefits available is:
- You can now on view using implicit linking
- You can now be used on the viewJOIN ...On the view you can also useJOIN ... ON KEY语法
- Before you can use on the view of embeddable key type,Just like on the table
欲了解更多信息,请参考:
更好的MERGE支持
We finally solved for more advancedMERGEThe support of the sentence,现在支持 :
- 多个WHEN MATCHED AND condition THEN UPDATE子句
- 多个WHEN MATCHED AND condition THEN DELETE子句
- UpdatableRecord.merge()And all the great things related to simplify record merge.
转换
With the parser and our translation tools(https://www.jooq.org/translate),我们将,More and more into the new cases,把jOOQ作为JavaCan be embedded in aDSL来使用. Our translation ability has very strong,A newSQL转换,They will become more powerful,帮助客户从RDBMS A 迁移到RDBMS B(如果他们犯了错误,还可以返回). Although our website translator is free,但jOOQLibraries can always,以编程方式使用,Or as a command-line tool.
In order to make the usage more useful,Have added new transformation function,包括:
- ROWNUM到LIMIT或ROW_NUMBER()
- Table list toANSI JOIN(包括Oracle(+)支持)
- Unnecessary arithmetic expression
这是一个令人兴奋的领域,We will be in the future for business license of our customers to explore,Even at the same timejOOQOpen source edition also from
These improvements benefit.例如,Created for the transformation of infrastructure,Finally can imitatePostgreSQL的DISTINCT ON子句,在其他地方.
更多信息,请参考:
Better manual
We step back and review some important part of our document,我们现在提供:
- 代码生成器技术(XML、Programmatic、Gradle)The sticky labels.如果 ,你正在使用Gradle与jOOQ的代码生成器,You don't want to see,在手册中的XML配置.These tags finally hide unnecessary information.
- Each function section.We have started a separate record for eachSQL函数,Explain it inSQL中是如何工作的,And provide some examples and the result of the example.
- Generate the vendor specificSQLInstances of rendering.When we generate manual usejOOQ,将一些jOOQ的APIUsage translated into all our support 方言,And display the function of rendering in each dialect.
- Display the import button and context sensitive import.All the examples in the manual will let people overwhelmed.We assume that a lot(静态)导入, ,We ended up at each snippet extensible "显示导入 "部分记录了
- We rewrite the parts,To make it more fully contains some example,For example, data import part.
- 一个新的APIBetween difference page shows each small versions of change,Javadoc链接列表:https://www.jooq.org/api-diff
边栏推荐
- 动作捕捉系统用于柔性机械臂的末端定位控制
- Four ways to clear the float and its principle understanding
- 1-hour live broadcast recruitment order: industry leaders share dry goods, and enterprise registration is open丨qubit · point of view
- 八大排序汇总及其稳定性
- Shell project combat 1. System performance analysis
- AI cocoa AI frontier introduction (7.31)
- SetoolKit使用指南
- C# control ListView usage
- IDEA connects to MySQL database and uses data
- 网络协议及相关技术详解
猜你喜欢
ECCV 2022 | 机器人的交互感知与物体操作
C#高级--委托
报错IDEA Terminated with exit code 1
【蓝桥杯选拔赛真题46】Scratch磁铁游戏 少儿编程scratch蓝桥杯选拔赛真题讲解
ADS与C#通信
3.爬虫之Scrapy框架1安装与使用
1-hour live broadcast recruitment order: industry leaders share dry goods, and enterprise registration is open丨qubit · point of view
尚硅谷-JVM-内存和垃圾回收篇(P1~P203)
网络协议及相关技术详解
go使用makefile脚本编译应用
随机推荐
C#控件ListView用法
百度网盘安装在c盘显示系统权限限制的解决方法
leetcode:2032. 至少在两个数组中出现的值
滑窗法切分数据
ICML2022 | Fully Granular Self-Semantic Propagation for Self-Supervised Graph Representation Learning
技能大赛dhcp服务训练题
【redis】发布和订阅消息
IDEA connects to MySQL database and uses data
深度剖析 Apache EventMesh 云原生分布式事件驱动架构
Miller_Rabin Miller Rabin probability sieve [template]
Sliding window method to segment data
Shell script classic case: backup of files
自制的数据库安全攻防题,相关靶机自己制作
uniapp微信小程序引用标准版交易组件
Error: npm ERR code EPERM
推荐系统-召回阶段-2013:DSSM(双塔模型)【Embedding(语义向量)召回】【微软】
IDEA如何运行web程序
Grab the tail of gold, silver and silver, unlock the programmer interview "Artifact of Brushing Questions"
Detailed explanation of network protocols and related technologies
战略进攻能力的重要性,要远远高于战略防守能力