use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class MetadataTools method addColumns.
public static void addColumns(Element anyMapping, Iterator selectables) {
while (selectables.hasNext()) {
final Selectable selectable = (Selectable) selectables.next();
if (selectable.isFormula()) {
throw new FormulaNotSupportedException();
}
addColumn(anyMapping, (Column) selectable);
}
}
use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class LegacyJpaNamingWithAnnotationBindingTests method validateCustomerAddressesElementComponent.
@Override
protected void validateCustomerAddressesElementComponent(Component component) {
assertEquals(3, component.getColumnSpan());
Iterator<Selectable> selectables = component.getColumnIterator();
int pass = 1;
while (selectables.hasNext()) {
final Column column = assertTyping(Column.class, selectables.next());
if (pass == 1) {
assertEquals("line1", column.getQuotedName());
} else if (pass == 2) {
assertEquals("line2", column.getQuotedName());
} else if (pass == 3) {
assertEquals("zipCode_id", column.getQuotedName());
}
pass++;
}
}
use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class LegacyJpaNamingWithAnnotationBindingTests method validateCustomerHqAddressComponent.
@Override
protected void validateCustomerHqAddressComponent(Component component) {
assertEquals(3, component.getColumnSpan());
Iterator<Selectable> selectables = component.getColumnIterator();
int pass = 1;
while (selectables.hasNext()) {
final Column column = assertTyping(Column.class, selectables.next());
if (pass == 1) {
assertEquals("line1", column.getQuotedName());
} else if (pass == 2) {
assertEquals("line2", column.getQuotedName());
} else if (pass == 3) {
assertEquals("zipCode_id", column.getQuotedName());
}
pass++;
}
}
use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class LegacyJpaNamingWithHbmBindingTests method validateCustomerAddressesElementComponent.
@Override
protected void validateCustomerAddressesElementComponent(Component component) {
assertEquals(3, component.getColumnSpan());
Iterator<Selectable> selectables = component.getColumnIterator();
int pass = 1;
while (selectables.hasNext()) {
final Column column = assertTyping(Column.class, selectables.next());
if (pass == 1) {
assertEquals("line1", column.getQuotedName());
} else if (pass == 2) {
assertEquals("line2", column.getQuotedName());
} else if (pass == 3) {
assertEquals("zipCode", column.getQuotedName());
}
pass++;
}
}
use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class AbstractEntityPersister method internalInitSubclassPropertyAliasesMap.
private void internalInitSubclassPropertyAliasesMap(String path, Iterator propertyIterator) {
while (propertyIterator.hasNext()) {
Property prop = (Property) propertyIterator.next();
String propname = path == null ? prop.getName() : path + "." + prop.getName();
if (prop.isComposite()) {
Component component = (Component) prop.getValue();
Iterator compProps = component.getPropertyIterator();
internalInitSubclassPropertyAliasesMap(propname, compProps);
} else {
String[] aliases = new String[prop.getColumnSpan()];
String[] cols = new String[prop.getColumnSpan()];
Iterator colIter = prop.getColumnIterator();
int l = 0;
while (colIter.hasNext()) {
Selectable thing = (Selectable) colIter.next();
aliases[l] = thing.getAlias(getFactory().getDialect(), prop.getValue().getTable());
// TODO: skip formulas?
cols[l] = thing.getText(getFactory().getDialect());
l++;
}
subclassPropertyAliases.put(propname, aliases);
subclassPropertyColumnNames.put(propname, cols);
}
}
}
Aggregations