The GitHub Actions job "Vulnerability Scan" on grails-core.git/8.0.x has 
succeeded.
Run started by GitHub user jdaugherty (triggered by jdaugherty).

Head commit for run:
c42431349954ba6d2ed28cea6391f6964c308af6 / Walter B Duque de Estrada 
<[email protected]>
Hibernate 7: unique groups on enum and collection properties (#16533)

* fix: unique groups on enum and collection properties

A unique group (unique: 'other' or unique: ['a', 'b']) creates a unique key over
the property's column and the columns of the listed properties. Two shapes were
broken:

- An enum property made no key at all: EnumTypeBinder never ran the unique key
  creation that ColumnBinder.bindColumn performs through CreateKeyForProps, so
  duplicates of the group were accepted by the database. EnumTypeBinder now 
calls
  CreateKeyForProps for the enum column, exactly as ColumnBinder does.
- A collection property made a key over a column its table lacks: the collection
  key is bound through ColumnBinder with the collection property, so the group
  became a unique key of the collection table that named the owner's column
  (x on ug_collection_group_tags). The collection table then failed to create
  and the first insert failed with "Table not found". The same path serves a
  basic collection of enums, via EnumTypeBinder. CreateKeyForProps now creates
  no key for a to-many property: the group's other columns are not in its table,
  so there is nothing meaningful to make. Hibernate 5 reaches the same code
  (bindColumn -> handleUniqueConstraint on the collection key) and, for enums,
  never creates the key either, so it has both defects; ignoring the group on a
  collection is the only consistent reading.

Plain unique: true on an enum already worked and is covered as a regression row.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* fix: keep the unique group key of a serializable to-many property

A to-many property mapped with type 'serializable' is bound as a plain
column of the owner table (GrailsPropertyBinder routes it through
bindBasicValue), so a unique group on it is valid and the previous code
created its key. The blanket exclusion added for collection tables
dropped that key; restrict it to to-many properties bound as collections.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

* fix: keep the unique group key of a to-many mapped with a user type

GrailsPropertyBinder binds a to-many property mapped with a user type as a
plain column of the owner table, like a serializable one, but the key
creation only exempted serializable, so duplicates the database used to
reject were allowed again. Both now use one shared condition,
HibernateToManyProperty.isBoundAsCollection, so they cannot drift apart.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

---------

Co-authored-by: Claude Sonnet 5.5 <[email protected]>

Report URL: https://github.com/apache/grails-core/actions/runs/38199736628

With regards,
GitHub Actions via GitBox

Reply via email to