I wasn’t sure about that - that would effectively mean deleting this block of code, as we skip that code if not isOptionalObjectInBatch(). So I figured that block of code was in for a reason. I think it is the same as getOptionalId() != null && rowCount > 1. But I didn’t see how to check rowCount > 1, as we don’t always have a row count. I guess we could look to see the ids that we’re loading to work this out… Definitely other ways to do this.


On 17/01/2014, at 6:42 pm, Brett Meyer <notifications@github.com> wrote:

> In hibernate-core/src/main/java/org/hibernate/loader/plan/exec/internal/EntityLoadQueryDetails.java:
> 
> > @@ -233,7 +233,8 @@ public Object readRow(ResultSet resultSet, ResultSetProcessingContextImpl contex
> >  					rootReturnReader.getIdentifierResolutionContext( context );
> >  			// if the entity reference we are hydrating is a Return, it is possible that its EntityKey is
> >  			// supplied by the QueryParameter optional entity information
> > -			if ( context.shouldUseOptionalEntityInformation() && context.getQueryParameters().getOptionalId() != null ) {
> > +			if ( context.shouldUseOptionalEntityInformation() && context.getQueryParameters().getOptionalId() != null &&
> Since "getOptionalId() != null" is technically the same as "isOptionalObjectInBatch()", isn't this additional check redundant? Can #optionalObjectInBatch be removed, period?
> 
> —
> Reply to this email directly or view it on GitHub.
>