DefaultFlushEntityEventListener.checkNaturalId() causes extra SELECTs on read-only entities

Description

Entities loaded by a read-only query are correctly loaded and no snapshot is stored. However, the call to checkNaturalId() causes the state to be re-read from the database unnecessarily.

Environment

None

Activity

Show:
Chris Bredesen
September 5, 2007, 11:42 PM

This happens when the entity (with natural-id) is read (read-only) and subsequently used in a many-to-one association. The fix seems to be simply skipping the checkNaturalId() call when the entity is read-only.

Steve Ebersole
March 21, 2011, 7:04 PM

Bulk closing stale resolved issues

Assignee

Chris Bredesen

Reporter

Chris Bredesen

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