HHH-8398 - StoredProcedureQuery passed resultClasses chooses incorrect aliases to extract results
This commit is contained in:
parent
d210c0cae2
commit
15e9b028b5
|
@ -251,6 +251,8 @@ public class ResultImpl implements Result {
|
|||
}
|
||||
|
||||
private static CustomLoaderExtension buildSpecializedCustomLoader(final ResultContext context) {
|
||||
// might be better to just manually construct the Return(s).. SQLQueryReturnProcessor does a lot of
|
||||
// work that is really unnecessary here.
|
||||
final SQLQueryReturnProcessor processor = new SQLQueryReturnProcessor(
|
||||
context.getQueryReturns(),
|
||||
context.getSession().getFactory()
|
||||
|
@ -292,8 +294,7 @@ public class ResultImpl implements Result {
|
|||
private QueryParameters queryParameters;
|
||||
private SessionImplementor session;
|
||||
|
||||
// temp
|
||||
private final CustomQuery customQuery;
|
||||
private boolean needsDiscovery = true;
|
||||
|
||||
public CustomLoaderExtension(
|
||||
CustomQuery customQuery,
|
||||
|
@ -302,14 +303,16 @@ public class ResultImpl implements Result {
|
|||
super( customQuery, session.getFactory() );
|
||||
this.queryParameters = queryParameters;
|
||||
this.session = session;
|
||||
|
||||
this.customQuery = customQuery;
|
||||
}
|
||||
|
||||
// todo : this would be a great way to add locking to stored procedure support (at least where returning entities).
|
||||
|
||||
public List processResultSet(ResultSet resultSet) throws SQLException {
|
||||
super.autoDiscoverTypes( resultSet );
|
||||
if ( needsDiscovery ) {
|
||||
super.autoDiscoverTypes( resultSet );
|
||||
// todo : EntityAliases discovery
|
||||
needsDiscovery = false;
|
||||
}
|
||||
return super.processResultSet(
|
||||
resultSet,
|
||||
queryParameters,
|
||||
|
@ -320,12 +323,5 @@ public class ResultImpl implements Result {
|
|||
Collections.<AfterLoadAction>emptyList()
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void validateAlias(String alias) {
|
||||
System.out.println(
|
||||
"TEMPORARY... discovered result set alias from stored procedure [" + alias + "] : " + customQuery.getSQL()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ import static org.junit.Assert.assertTrue;
|
|||
* @author Steve Ebersole
|
||||
*/
|
||||
@RequiresDialect( H2Dialect.class )
|
||||
public class JpaUsageTest extends BaseEntityManagerFunctionalTestCase {
|
||||
public class JpaTckUsageTest extends BaseEntityManagerFunctionalTestCase {
|
||||
|
||||
@Test
|
||||
public void testMultipleGetUpdateCountCalls() {
|
||||
|
@ -60,7 +60,7 @@ public class JpaUsageTest extends BaseEntityManagerFunctionalTestCase {
|
|||
// this is what the TCK attempts to do, don't shoot the messenger...
|
||||
query.getUpdateCount();
|
||||
// yep, twice
|
||||
int updateCount = query.getUpdateCount();
|
||||
query.getUpdateCount();
|
||||
|
||||
em.getTransaction().commit();
|
||||
em.close();
|
Loading…
Reference in New Issue