Search in sources :

Example 1 with JaxbHbmNativeQueryScalarReturnType

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);
}
Also used : JaxbHbmNativeQueryJoinReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryJoinReturnType) JaxbHbmNativeQueryReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryReturnType) JaxbHbmNativeQueryCollectionLoadReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryCollectionLoadReturnType) JaxbHbmNativeQueryScalarReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryScalarReturnType) JaxbHbmNativeQueryPropertyReturnType(org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryPropertyReturnType) Type(org.hibernate.type.Type) MappingException(org.hibernate.boot.MappingException) NativeSQLQueryScalarReturn(org.hibernate.engine.query.spi.sql.NativeSQLQueryScalarReturn)

Aggregations

MappingException (org.hibernate.boot.MappingException)1 JaxbHbmNativeQueryCollectionLoadReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryCollectionLoadReturnType)1 JaxbHbmNativeQueryJoinReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryJoinReturnType)1 JaxbHbmNativeQueryPropertyReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryPropertyReturnType)1 JaxbHbmNativeQueryReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryReturnType)1 JaxbHbmNativeQueryScalarReturnType (org.hibernate.boot.jaxb.hbm.spi.JaxbHbmNativeQueryScalarReturnType)1 NativeSQLQueryScalarReturn (org.hibernate.engine.query.spi.sql.NativeSQLQueryScalarReturn)1 Type (org.hibernate.type.Type)1