/** * Generate a column alias that is unique across multiple tables */ @Override public String getAlias(Dialect dialect, Table table) { return safeInterning( getAlias( dialect ) + table.getUniqueInteger() + '_' ); }
/** * Column aliases utilize {@link Table#getUniqueInteger()} for naming. The unique integer used to be statically * generated by the Table class, meaning it was dependent on mapping order. HHH-2448 made the alias names * deterministic by having Configuration determine the unique integers on its second pass over the Tables tree map. * AliasTest and {@link MappingReorderedAliasTest} ensure that the unique integers are the same, regardless of * mapping ordering. */ @Test @TestForIssue( jiraKey = "HHH-2448" ) public void testAliasOrdering() { Iterator<Table> tables = metadata().collectTableMappings().iterator(); Table table1 = null; Table table2 = null; while ( tables.hasNext() ) { Table table = tables.next(); if ( table.getName().equals( "Table1" ) ) { table1 = table; } else if ( table.getName().equals( "Table2" ) ) { table2 = table; } } assertTrue( table1.getUniqueInteger() < table2.getUniqueInteger() ); }
/** * Generate a column alias that is unique across multiple tables */ public String getAlias(Dialect dialect, Table table) { return getAlias(dialect) + table.getUniqueInteger() + '_'; }
/** * Generate a column alias that is unique across multiple tables */ public String getAlias(Dialect dialect, Table table) { return getAlias(dialect) + table.getUniqueInteger() + '_'; }
/** * Generate a column alias that is unique across multiple tables */ public String getAlias(Table table) { return getAlias() + table.getUniqueInteger() + '_'; }
/** * Generate a column alias that is unique across multiple tables */ public String getAlias(Dialect dialect, Table table) { return getAlias(dialect) + table.getUniqueInteger() + '_'; }