Investigate unifying natural-id and unique-key handling

Description

There are a lot of similarities and "shared logic" between handling natural-ids and unique-keys within a Session. Investigate whether we can unify the handling.

As a bonus, if we are able to, we could begin to expose a load-by-unique-key much like we do with load-by-natural-id.

See:

  • org.hibernate.engine.spi.EntityUniqueKey

  • org.hibernate.engine.spi.PersistenceContext#getEntity(EntityUniqueKey)

  • org.hibernate.engine.spi.PersistenceContext#addEntity(EntityUniqueKey, Object)

  • org.hibernate.engine.internal.NaturalIdXrefDelegate

Environment

None

Assignee

Unassigned

Reporter

Steve Ebersole

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major
Configure