EntityManager/Session setProperty should permit custom properties

Description

The spec for EntityManager.setProperty(String propertyName, Object value) says: "Set an entity manager property or hint. If a vendor-specific property or hint is not recognized, it is silently ignored."

This means that vendor-specific (i.e. custom) properties will be silently ignored, but Hibernate Session implementation seems to interpret ignored as discarded (see SessionImpl.java#L3571) for no reason.

A developer should have means to set arbitrary objects as properties of a session, to set them at some point and retrieve their values later during the same session. A simple use case:

and then retrieve "current-locale" value in an event listener (e.g. PreInsert and PostLoad).

Environment

None

Assignee

Chris Cranford

Reporter

Giovanni Lovato

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure