[hibernate-issues] [Hibernate-JIRA] Created: (HHH-6309) Change org.hibernate.impl.SessionImpl.instantiate(EntityPersister , Serializable) to call persister.setIdentifier(...) if interceptor returns a non-null value

Chris Webb (JIRA) noreply at atlassian.com
Sun Jun 12 11:31:26 EDT 2011


Change org.hibernate.impl.SessionImpl.instantiate(EntityPersister , Serializable) to call persister.setIdentifier(...) if interceptor returns a non-null value
--------------------------------------------------------------------------------------------------------------------------------------------------------------

                 Key: HHH-6309
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HHH-6309
             Project: Hibernate Core
          Issue Type: Improvement
          Components: core
    Affects Versions: 3.6.5
            Reporter: Chris Webb


org.hibernate.Interceptor.instantiate(String entityName, EntityMode entityMode, Serializable id) does not have any way of leveraging the EntityPersister to set the identifier so this should be done in SessionImpl.instantiate if the interceptor returns a non-null value by calling persister.setIdentifier(result, id, this).

Here is the completed change:
{code:title=org.hibernate.impl.SessionImpl.java|borderStyle=solid}
public Object instantiate(EntityPersister persister, Serializable id) throws HibernateException {
	errorIfClosed();
	checkTransactionSynchStatus();
	Object result = interceptor.instantiate( persister.getEntityName(), entityMode, id );
	if ( result == null ) {
		result = persister.instantiate( id, this );
	}
	else {
		// Set the id for the object instantiated by the interceptor.
		persister.setIdentifier(result, id, this);
	}

	return result;
}
{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://opensource.atlassian.com/projects/hibernate/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the hibernate-issues mailing list