use of org.hibernate.loader.custom.CustomQuery in project hibernate-orm by hibernate.
the class OutputsImpl method buildSpecializedCustomLoader.
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// Hooks into Hibernate's Loader hierarchy for ResultSet -> Object mapping
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());
processor.process();
final List<org.hibernate.loader.custom.Return> customReturns = processor.generateCallableReturns();
CustomQuery customQuery = new CustomQuery() {
@Override
public String getSQL() {
return context.getSql();
}
@Override
public Set<String> getQuerySpaces() {
return context.getSynchronizedQuerySpaces();
}
@Override
public List<ParameterBinder> getParameterValueBinders() {
// no parameters in terms of embedded in the SQL string
return Collections.emptyList();
}
@Override
public List<org.hibernate.loader.custom.Return> getCustomQueryReturns() {
return customReturns;
}
};
return new CustomLoaderExtension(customQuery, context.getQueryParameters(), context.getSession());
}
Aggregations