EntityManager.getReference behaving inconsistently

Description

According to the JPA spec:
— The EntityNotFoundException is thrown by the persistence provider when an entityreference obtained by getReference is accessed but the entity does not exist.

However, when you access the id field that you passed to the getReference call, no exception is thrown. Is this the correct behavior? From the logs, it doesn't run the SQL if you access the ID, but it runs it if you access any other field.

Environment

None

Assignee

Unassigned

Reporter

Frank Pilloni Tominc (franktominc)

Fix versions

None

Labels

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure