support for TypedQuery jpaql/hql "scalar" queries

Description

I'm getting a
java.lang.IllegalArgumentException: Cannot create TypedQuery for query with more than one return

with a query that returns a View object.

AbstractEntityManager:279, detects as many returns type as there is parameters in the View object, instead of one single result type, the View Object itself.

QueryString example that fails with public <T> TypedQuery<T> createQuery(String jpaqlString, Class<T> resultClass):

"select new WorkContractDto(wc.workContractStartDate, wc.workContractEndDate, wc.workContractEmployeeLastName, wc.workContractSendingStatus) from WorkContract wc where wc.workContractEmployeeLastName = ?1"

Attachments

2

Activity

Show:

Oliver MayerFebruary 2, 2012 at 8:14 AM

Ok, i got it. Its a duplicate. I hope it will be fixed in near future.

Oliver MayerFebruary 2, 2012 at 8:10 AM

but i see your posts for named queries in https://hibernate.onjira.com/browse/HHH-6695.

Former userFebruary 2, 2012 at 1:22 AM

The issue using a named query is covered by HHH-6304.

Oliver MayerFebruary 1, 2012 at 10:38 AM

if ( namedQuery.getReturnTypes().length != 1 ) {
throw new IllegalArgumentException( "Cannot create TypedQuery for query with more than one return" );
}

Oliver MayerFebruary 1, 2012 at 10:32 AM

Doesnt work on hibernate 4.0.1-Final

Fixed

Details

Assignee

Reporter

Time tracking

2.28h logged

Components

Fix versions

Priority

Created June 30, 2010 at 11:34 AM
Updated February 2, 2012 at 8:14 AM
Resolved August 19, 2011 at 6:56 PM