Documentation bug at SimpleNaturalIdLoadAccess.getReference(Object naturalIdValue)

Description

The method

SimpleNaturalIdLoadAccess.getReference(Object naturalIdValue)

is documented with

"@return the persistent instance or proxy"

This is wrong. The method returns null if the entity is not found.

See implementation

@Override
public Object getReference(Object naturalIdValue) {
final Serializable entityId =
resolveNaturalId( getNaturalIdParameters( naturalIdValue ) );
if ( entityId == null ) {
return null;
}
return this.getIdentifierLoadAccess().getReference( entityId );
}

TestCase:

getSession().bySimpleNaturalId(User.class).getReference("NO_USER_WITH_THIS_NAME");

Environment

4.1.8, postgresql

Status

Assignee

Brett Meyer

Reporter

Janning Vygen

Fix versions

Labels

backPortable

None

Suitable for new contributors

Yes, likely

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure