org.hibernate.dialect.Dialect#getMaxAliasLength is the maximum length before uniquing info is added to the alias. Typically this number ought to be 10 or more less than the real max for the database.