This happens with POJOs and with dynamic classes.
This bug is a duplicate of HHH-4950 (Hibernate doesn't support locking read-only objects).
If the current behavior is considered correct, a more meaningful exception should be thrown, with a message like "read-only objects can't be locked".
I attach a test case that shows the problem when using POJOs, as well as a fixed version of the previous attachment.
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
This happens with POJOs and with dynamic classes.
This bug is a duplicate of HHH-4950 (Hibernate doesn't support locking read-only objects).
If the current behavior is considered correct, a more meaningful exception should be thrown, with a message like "read-only objects can't be locked".
I attach a test case that shows the problem when using POJOs, as well as a fixed version of the previous attachment.