Multiple different result sets from stored procedure

Description

The issue occurs when executing a StoredProcedureQuery to retrieve multiple result sets in which the result sets have different columns.

The following construction is intended to handle 7 result sets by providing 7 different classes, one for each result set.

StoredProcedureQuery spq = em.createStoredProcedureQuery("spGetInfo",
R1.class, R2.class, R3.class, R4.class, R5.class, R6.class, R7.class);

However, it appears that org.hibernate.loader.Loader is attempting to map each result set to each class specified in (see line 783-786)

for ( int i = 0; i < numberOfPersistersToProcess; i++ ) {
final Type idType = persisters[i].getIdentifierType();
hydratedKeyState[i] = idType.hydrate( resultSet, getEntityAliases()[i].getSuffixedKeyAliases(), session, null );
}

The Java EE documentation leads one to expect that the first result set will be mapped to the first class, the second to the second, etc.

The resultClass arguments must be specified in the order in which the result sets will be returned by the stored procedure invocation.

(http://docs.oracle.com/javaee/7/api/index.html?javax/persistence/EntityManager.html)

Environment

SQL Server 2008

Assignee

Unassigned

Reporter

Jim Beale

Fix versions

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Major
Configure