Fix some alerts from LGTM

Description

LGTM has raised some alerts during analysis of Hibernate ORM (https://lgtm.com/projects/g/hibernate/hibernate-orm/alerts/?mode=tree). This issue is to fix some of those alerts.

Environment

None

Assignee

Malcolm Taylor

Reporter

Malcolm Taylor

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Priority

Major
Configure