indexComponent.addProperty( newProperty );
}
return indexComponent;
}
else if ( value instanceof SimpleValue ) {
SimpleValue sourceValue = (SimpleValue) value;
SimpleValue targetValue;
if ( value instanceof ManyToOne ) {
ManyToOne sourceManyToOne = (ManyToOne) sourceValue;
ManyToOne targetManyToOne = new ManyToOne( collection.getCollectionTable() );
targetManyToOne.setFetchMode( FetchMode.DEFAULT );
targetManyToOne.setLazy( true );
//targetValue.setIgnoreNotFound( ); does not make sense for a map key
targetManyToOne.setReferencedEntityName( sourceManyToOne.getReferencedEntityName() );
targetValue = targetManyToOne;
}
else {
targetValue = new SimpleValue( collection.getCollectionTable() );
targetValue.setTypeName( sourceValue.getTypeName() );
targetValue.setTypeParameters( sourceValue.getTypeParameters() );
}
Iterator columns = sourceValue.getColumnIterator();
Random random = new Random();
while ( columns.hasNext() ) {
Object current = columns.next();
Formula formula = new Formula();
String formulaString;
if ( current instanceof Column ) {
formulaString = ( (Column) current ).getQuotedName();
}
else if ( current instanceof Formula ) {
formulaString = ( (Formula) current ).getFormula();
}
else {
throw new AssertionFailure( "Unknown element in column iterator: " + current.getClass() );
}
if ( fromAndWhere != null ) {
formulaString = Template.renderWhereStringTemplate( formulaString, "$alias$", new HSQLDialect() );
formulaString = "(select " + formulaString + fromAndWhere + ")";
formulaString = StringHelper.replace(
formulaString,
"$alias$",
"a" + random.nextInt( 16 )
);
}
formula.setFormula( formulaString );
targetValue.addFormula( formula );
}
return targetValue;
}
else {