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:
@@ -0,0 +1,31 @@
|
||||
# Null components and null elements in a collection of records
|
||||
# Hibernate ORM 7.4.17.Final, H2 2.4.240, JDK 25
|
||||
-- Set<Tag>: add Tag(java, null)
|
||||
sql> insert into Article (id) values (?)
|
||||
sql> insert into Article_tagSet (Article_id,name,colour) values (?,?,?)
|
||||
=> added
|
||||
rows: [1 | null | java]
|
||||
-- Set<Tag>: add Tag(null, null)
|
||||
sql> select a1_0.id from Article a1_0 where a1_0.id=?
|
||||
sql> select ts1_0.Article_id,ts1_0.name,ts1_0.colour from Article_tagSet ts1_0 where ts1_0.Article_id=?
|
||||
sql> delete from Article_tagSet where Article_id=?
|
||||
sql> insert into Article_tagSet (Article_id,name,colour) values (?,?,?)
|
||||
sql> insert into Article_tagSet (Article_id,name,colour) values (?,?,?)
|
||||
=> added
|
||||
rows: [1 | null | null, 1 | null | java]
|
||||
-- List<Tag> (bag): add Tag(null, null)
|
||||
sql> select a1_0.id from Article a1_0 where a1_0.id=?
|
||||
sql> select tb1_0.Article_id,tb1_0.name,tb1_0.colour from Article_tagBag tb1_0 where tb1_0.Article_id=?
|
||||
sql> insert into Article_tagBag (Article_id,name,colour) values (?,?,?)
|
||||
=> added
|
||||
rows: [1 | null | null]
|
||||
-- load tagBag
|
||||
sql> select a1_0.id from Article a1_0 where a1_0.id=?
|
||||
sql> select tb1_0.Article_id,tb1_0.name,tb1_0.colour from Article_tagBag tb1_0 where tb1_0.Article_id=?
|
||||
=> []
|
||||
(what a reader of the collection gets back)
|
||||
-- List<Tag> (bag): add a null element
|
||||
sql> select a1_0.id from Article a1_0 where a1_0.id=?
|
||||
sql> select tb1_0.Article_id,tb1_0.name,tb1_0.colour from Article_tagBag tb1_0 where tb1_0.Article_id=?
|
||||
=> added
|
||||
rows: [1 | null | null]
|
||||
Reference in New Issue
Block a user