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 CollectionMetadataGenerator method searchMappedByKey.
@SuppressWarnings({ "unchecked" })
private String searchMappedByKey(PersistentClass referencedClass, Collection collectionValue) {
final Iterator<Value> assocIdClassProps = referencedClass.getKeyClosureIterator();
while (assocIdClassProps.hasNext()) {
final Value value = assocIdClassProps.next();
// make sure its a 'Component' because IdClass is registered as this type.
if (value instanceof Component) {
final Component component = (Component) value;
final Iterator<Property> componentPropertyIterator = component.getPropertyIterator();
while (componentPropertyIterator.hasNext()) {
final Property property = componentPropertyIterator.next();
final Iterator<Selectable> propertySelectables = property.getValue().getColumnIterator();
final Iterator<Selectable> collectionSelectables = collectionValue.getKey().getColumnIterator();
if (Tools.iteratorsContentEqual(propertySelectables, collectionSelectables)) {
return property.getName();
}
}
}
}
return null;
}
use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class AbstractSchemaValidator method validateTable.
protected void validateTable(Table table, TableInformation tableInformation, Metadata metadata, ExecutionOptions options, Dialect dialect) {
if (tableInformation == null) {
throw new SchemaManagementException(String.format("Schema-validation: missing table [%s]", table.getQualifiedTableName().toString()));
}
final Iterator selectableItr = table.getColumnIterator();
while (selectableItr.hasNext()) {
final Selectable selectable = (Selectable) selectableItr.next();
if (Column.class.isInstance(selectable)) {
final Column column = (Column) selectable;
final ColumnInformation existingColumn = tableInformation.getColumn(Identifier.toIdentifier(column.getQuotedName()));
if (existingColumn == null) {
throw new SchemaManagementException(String.format("Schema-validation: missing column [%s] in table [%s]", column.getName(), table.getQualifiedTableName()));
}
validateColumnType(table, column, existingColumn, metadata, options, dialect);
}
}
}
use of org.hibernate.mapping.Selectable in project hibernate-orm by hibernate.
the class LegacyJpaNamingWithHbmBindingTests 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", column.getQuotedName());
}
pass++;
}
}
Aggregations