Add embeddables module: @Embeddable records in Hibernate 7.4.17.Final (columns and round trip, null handling, collections of embeddables and their SQL, record equality vs database equality, @EmbeddedId records, DDD Email value object, failure modes; H2)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b3obqqePfZ9m2Jk5Ub
This commit is contained in:
Claude
2026-11-26 18:14:43 +05:30
parent ec6eda8650
commit 4c795e8b50
45 changed files with 1453 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
# The same record type embedded twice (Address as billing and shipping), with a nested record (Geo)
# Hibernate ORM 7.4.17.Final, H2 2.4.240, JDK 25
== Columns of table customer
LAT | DOUBLE PRECISION | null | 53 | null | YES
LON | DOUBLE PRECISION | null | 53 | null | YES
SHIP_LAT | DOUBLE PRECISION | null | 53 | null | YES
SHIP_LON | DOUBLE PRECISION | null | 53 | null | YES
ID | BIGINT | null | 64 | 0 | NO
CITY | CHARACTER VARYING | 255 | null | null | YES
SHIP_CITY | CHARACTER VARYING | 255 | null | null | YES
SHIP_STREET | CHARACTER VARYING | 255 | null | null | YES
SHIP_ZIP | CHARACTER VARYING | 255 | null | null | YES
STREET | CHARACTER VARYING | 255 | null | null | YES
ZIP | CHARACTER VARYING | 255 | null | null | YES
== Load it back
-- find Customer 1
sql> select c1_0.id,c1_0.street,c1_0.city,c1_0.zip,c1_0.lat,c1_0.lon,c1_0.ship_street,c1_0.ship_city,c1_0.ship_zip,c1_0.ship_lat,c1_0.ship_lon from Customer c1_0 where c1_0.id=?
=> billing=Address[street=1 MG Road, city=Pune, zip=411001, geo=Geo[lat=18.5, lon=73.8]] shipping=Address[street=9 Marine Dr, city=Mumbai, zip=400020, geo=null]