use of org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryScalarReturnType in project hibernate-orm by hibernate.
the class ResultSetMappingBinder method extractReturnDescription.
// todo : look to add query/resultset-mapping name to exception messages here.
// needs a kind of "context", i.e.:
// "Unable to resolve type [%s] specified for native query scalar return"
// becomes
// "Unable to resolve type [%s] specified for native query scalar return as part of [query|resultset-mapping] [name]"
//
// MappingException already carries origin, adding the query/resultset-mapping name pinpoints the location :)
public static NativeSQLQueryScalarReturn extractReturnDescription(JaxbHbmNativeQueryScalarReturnType rtnSource, HbmLocalMetadataBuildingContext context) {
final String column = rtnSource.getColumn();
final String typeName = rtnSource.getType();
Type type = null;
if (typeName != null) {
type = context.getMetadataCollector().getTypeResolver().heuristicType(typeName);
if (type == null) {
throw new MappingException(String.format("Unable to resolve type [%s] specified for native query scalar return", typeName), context.getOrigin());
}
}
return new NativeSQLQueryScalarReturn(column, type);
}
Aggregations