public static void createUniqueConstraint(Value value) { Iterator iter = value.getColumnIterator(); ArrayList cols = new ArrayList(); while ( iter.hasNext() ) { cols.add( iter.next() ); } value.getTable().createUniqueKey( cols ); }
private boolean propertyIteratorContainsColumn(Iterator propertyIterator, Column column) { for ( Iterator it = propertyIterator; it.hasNext(); ) { final Property property = (Property) it.next(); for ( Iterator<Selectable> selectableIterator = property.getColumnIterator(); selectableIterator.hasNext(); ) { final Selectable selectable = selectableIterator.next(); if ( column.equals( selectable ) ) { final Column iteratedColumn = (Column) selectable; if ( column.getValue().getTable().equals( iteratedColumn.getValue().getTable() ) ) { return true; } } } } return false; }
String dependentTable = sp.getValue().getTable().getQualifiedTableName().render(); if ( dependentTable.compareTo( startTable ) == 0 ) { throw new AnnotationException( "Foreign key circularity dependency involving the following tables: " + startTable + ", " + dependentTable );
public void addProperty(Property prop, XClass declaringClass) { if ( prop.getValue() instanceof Component ) { //TODO handle quote and non quote table comparison String tableName = prop.getValue().getTable().getName(); if ( getJoinsPerRealTableName().containsKey( tableName ) ) { final Join join = getJoinsPerRealTableName().get( tableName ); addPropertyToJoin( prop, declaringClass, join ); } else { addPropertyToPersistentClass( prop, declaringClass ); } } else { addPropertyToPersistentClass( prop, declaringClass ); } }
protected String getTableNameForLogging(Column column) { if ( getTable() != null ) { if ( getTable().getNameIdentifier() != null ) { return getTable().getNameIdentifier().getCanonicalName(); } else { return "<unknown>"; } } else if ( column.getValue() != null && column.getValue().getTable() != null ) { return column.getValue().getTable().getNameIdentifier().getCanonicalName(); } return "<unknown>"; }
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() ); cols[l] = thing.getText( getFactory().getDialect() ); // TODO: skip formulas? l++; } subclassPropertyAliases.put( propname, aliases ); subclassPropertyColumnNames.put( propname, cols ); } } }
@Test @TestForIssue(jiraKey = "HHH-5848") public void testDatabaseTableNames() { PersistentClass classMapping = metadata().getEntityBinding( Item.class.getName() ); Column secTabColumn = (Column) classMapping.getProperty( "specialPrice" ).getColumnIterator().next(); assertEquals( "TAB_ITEMS_SEC", secTabColumn.getValue().getTable().getName() ); Column tabColumn = (Column) classMapping.getProperty( "price" ).getColumnIterator().next(); assertEquals( "TAB_ITEMS", tabColumn.getValue().getTable().getName() ); } }
while ( colIter.hasNext() ) { Selectable thing = (Selectable) colIter.next(); colAliases[k] = thing.getAlias( dialect, prop.getValue().getTable() ); if ( thing.isFormula() ) { foundFormula = true; columns.add( colName ); cols[l] = colName; aliases.add( thing.getAlias( dialect, prop.getValue().getTable() ) ); columnsLazy.add( lazy ); columnSelectables.add( Boolean.valueOf( prop.isSelectable() ) );
identifier.getTable(), col.getQuotedName() );
while ( iter.hasNext() ) { Property prop = (Property) iter.next(); String tabname = prop.getValue().getTable().getQualifiedName( factory.getDialect(), factory.getSettings().getDefaultCatalogName(), while ( iter.hasNext() ) { Property prop = (Property) iter.next(); Table tab = prop.getValue().getTable(); String tabname = tab.getQualifiedName( factory.getDialect(),
public static void createUniqueConstraint(Value value) { Iterator iter = value.getColumnIterator(); ArrayList cols = new ArrayList(); while ( iter.hasNext() ) { cols.add( iter.next() ); } value.getTable().createUniqueKey( cols ); }
String dependentTable = sp.getValue().getTable().getQuotedName(); if ( dependentTable.compareTo( startTable ) == 0 ) { StringBuilder sb = new StringBuilder(
public void addProperty(Property prop, XClass declaringClass) { if ( prop.getValue() instanceof Component ) { //TODO handle quote and non quote table comparison String tableName = prop.getValue().getTable().getName(); if ( getJoinsPerRealTableName().containsKey( tableName ) ) { final Join join = getJoinsPerRealTableName().get( tableName ); addPropertyToJoin( prop, declaringClass, join ); } else { addPropertyToPersistentClass( prop, declaringClass ); } } else { addPropertyToPersistentClass( prop, declaringClass ); } }
table = otherSideProperty.getValue().getTable();
String defaultName = mappings.getLogicalColumnName( col.getQuotedName(), identifier.getTable() ); if ( pkJoinAnn != null || joinAnn != null ) { String colName;
public static void createUniqueConstraint(Value value) { Iterator iter = value.getColumnIterator(); ArrayList cols = new ArrayList(); while ( iter.hasNext() ) { cols.add( iter.next() ); } value.getTable().createUniqueKey( cols ); }
public static void createUniqueConstraint(Value value) { Iterator iter = value.getColumnIterator(); ArrayList cols = new ArrayList(); while ( iter.hasNext() ) { cols.add( iter.next() ); } value.getTable().createUniqueKey( cols ); }
table = otherSideProperty.getValue().getTable();
protected Property createProperty(Value value, PersistentClass persistentClass, PersistentProperty grailsProperty, Mappings mappings) { // set type value.setTypeUsingReflection(persistentClass.getClassName(), grailsProperty.getName()); if (value.getTable() != null) { value.createForeignKey(); } Property prop = new Property(); prop.setValue(value); bindProperty(grailsProperty, prop, mappings); return prop; }
private static Property createProperty(Value value, PersistentClass persistentClass, GrailsDomainClassProperty grailsProperty, Mappings mappings) { // set type value.setTypeUsingReflection(persistentClass.getClassName(), grailsProperty.getName()); if (value.getTable() != null) { value.createForeignKey(); } Property prop = new Property(); prop.setValue(value); bindProperty(grailsProperty, prop, mappings); return prop; }