Hi,
I'm a new user being stymied by what I think should be a really straightforward operation. I am trying to load a user from the database, attach it to a new object, and then persist that new object. I am seeing the error
Code:
Unable to complete task: org.hibernate.exception.ConstraintViolationException: Cannot insert the value NULL into column 'ACTOR', table 'MY_DATABASE.dbo.AUDIT_LOG_ENTRY'; column does not allow nulls. INSERT fails.
My understanding was that the load() method throws an exception if the User object can't be found in the database. Just to be sure, I checked, and it is definitely not null. I know it might be a proxy, but I'm in the same session, so that shouldn't be an issue, right? What am I doing wrong here?
Code:
final Integer userId = ...;
final User user =
(User) session.load(User.class, userId);
final AuditLogEntry auditLogEntry = new AuditLogEntry();
// other properties are set here
auditLogEntry.setActor(user);
session.save(auditLogEntry);
Thanks,
Eric