Actually , it seems like this is more bad assumptions on the part of the TCK. Essentially they are assume make the assumption that the proc may return "partial" results for the named passed "result class".
Unfortunately the spec is silent on how exactly "result class(es)" are to be interpreted in regards to this new proc support. The closest bearing (in my reading) on the subject is section {{3.10.16.1}} which discusses native-sql support and returning managed entities:
{quote} ... When an entity is to be returned from a native query, the SQL statement should select all of the columns that are mapped to the entity object. This should include foreign key columns to related entities. The results obtained when insufficient data is available are undefined.
In the simplest case—i.e., when the results of the query are limited to entities of a single entity class and the mapping information can be derived from the columns of the SQL result and the object/relational mapping metadata—it is sufficient to specify only the expected class of the entity result. The following example illustrates the case where a native SQL query is created dynamically using the createNativeQuery method and the entity class that specifies the type of the result is passed in as an argument. {quote}
It then shows an example: {code} Query q = em.createNativeQuery( "SELECT o.id, o.quantity, o.item " + "FROM Order o, Item i " + "WHERE (o.item = i.id) AND (i.name = 'widget')", com.acme.Order.class); {code}
This form of {{EntityManager#createNativeQuery}} taking a {{Class}} argument is the closest corollary to the varargs form of {{EntityManager#createStoredProcedureQuery}}. {{createNativeQuery}} has no overloaded varargs form, so there is no exact equivalent.
An argument could be made that the passed classes might instead represent a request for 'dynamic instantiation', but thats an invalid argument to me since 'dynamic instantiation' is only defined in native-sql support in the case of an explicitly supplied {{SqlResultSetMapping}}. {{StoredProcedureQuery}} also defines separate {{SqlResultSetMapping}} support.
|