use of org.hibernate.loader.ast.internal.CollectionLoaderNamedQuery in project hibernate-orm by hibernate.
the class AbstractCollectionPersister method postInstantiate.
// private class ColumnMapperImpl implements ColumnMapper {
// @Override
// public SqlValueReference[] map(String reference) {
// final String[] columnNames;
// final String[] formulaTemplates;
//
// // handle the special "$element$" property name...
// if ( "$element$".equals( reference ) ) {
// columnNames = elementColumnNames;
// formulaTemplates = elementFormulaTemplates;
// }
// else {
// columnNames = elementPropertyMapping.toColumns( reference );
// formulaTemplates = formulaTemplates( reference, columnNames.length );
// }
//
// final SqlValueReference[] result = new SqlValueReference[ columnNames.length ];
// int i = 0;
// for ( final String columnName : columnNames ) {
// if ( columnName == null ) {
// // if the column name is null, it indicates that this index in the property value mapping is
// // actually represented by a formula.
// // final int propertyIndex = elementPersister.getEntityMetamodel().getPropertyIndex( reference );
// final String formulaTemplate = formulaTemplates[i];
// result[i] = new FormulaReference() {
// @Override
// public String getFormulaFragment() {
// return formulaTemplate;
// }
// };
// }
// else {
// result[i] = new ColumnReference() {
// @Override
// public String getColumnName() {
// return columnName;
// }
// };
// }
// i++;
// }
// return result;
// }
// }
// private String[] formulaTemplates(String reference, int expectedSize) {
// try {
// final int propertyIndex = elementPersister.getEntityMetamodel().getPropertyIndex( reference );
// return ( (Queryable) elementPersister ).getSubclassPropertyFormulaTemplateClosure()[propertyIndex];
// }
// catch (Exception e) {
// return new String[expectedSize];
// }
// }
@Override
public void postInstantiate() throws MappingException {
if (queryLoaderName == null) {
collectionLoader = createCollectionLoader(LoadQueryInfluencers.NONE);
} else {
// We pass null as metamodel because we did the initialization during construction already
final NamedQueryMemento namedQueryMemento = factory.getQueryEngine().getNamedObjectRepository().resolve(factory, null, queryLoaderName);
collectionLoader = new CollectionLoaderNamedQuery(this, namedQueryMemento);
}
if (attributeMapping.getIndexDescriptor() != null) {
collectionElementLoaderByIndex = new CollectionElementLoaderByIndex(attributeMapping, baseIndex, LoadQueryInfluencers.NONE, getFactory());
}
}
Aggregations