Add json-columns module: JSON columns in Hibernate 7.4.14 (@JdbcTypeCode(SqlTypes.JSON)), JSONB querying, GIN/expression indexes, dirty checking, Jackson 3 vs 2 on PostgreSQL 18.6 and MySQL 8.0.46
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b6Kg9RWSTJzyz6KP9X
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
|
||||
== persist(): the INSERT Hibernate sends (one bind per JSON column)
|
||||
sql> insert into product (attributes,dimensions,name,specs,tags) values (?,?,?,?,?)
|
||||
sql> update product set attributes=?,dimensions=?,name=?,specs=?,tags=? where id=?
|
||||
|
||||
== what PostgreSQL stored (jsonb text)
|
||||
attributes = {"color": "red", "price": 19.90, "ratio": 0.5, "stock": 12, "active": true, "nested": {"k": [1, 2, 3]}, "nothing": null, "bigNumber": 3000000000}
|
||||
tags = ["lighting", "office"]
|
||||
dimensions = {"depthMm": 180, "widthMm": 180, "heightMm": 420}
|
||||
specs = {"material": "steel", "weightKg": 1.8, "certifications": ["CE", "RoHS"]}
|
||||
|
||||
== loaded back in a new session: Java types of the Map values
|
||||
color -> String red
|
||||
price -> Double 19.9
|
||||
ratio -> Double 0.5
|
||||
stock -> Integer 12
|
||||
active -> Boolean true
|
||||
nested -> LinkedHashMap {k=[1, 2, 3]}
|
||||
nothing -> null null
|
||||
bigNumber -> Long 3000000000
|
||||
dimensions -> Dimensions[widthMm=180, heightMm=420, depthMm=180]
|
||||
specs -> steel, 1.8, [CE, RoHS]
|
||||
|
||||
== Java null vs JSON null vs empty
|
||||
null-attrs | attributes=SQL NULL | tags=SQL NULL | dimensions=SQL NULL
|
||||
empty-attrs | attributes={} | tags=[] | dimensions=SQL NULL
|
||||
loaded null-attrs : attributes=null tags=null
|
||||
loaded empty-attrs : attributes={} tags=[]
|
||||
Reference in New Issue
Block a user