diff --git a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java index 9784e82cc8..8a6a7a4849 100644 --- a/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java +++ b/hibernate-core/src/main/java/org/hibernate/sql/ast/spi/AbstractSqlAstTranslator.java @@ -4440,6 +4440,16 @@ public abstract class AbstractSqlAstTranslator implemen && !( getCurrentQueryPart() instanceof QueryGroup ) ) { appendSql( '*' ); } + else if ( columnAliases != null ) { + String separator = ""; + for ( String columnAlias : columnAliases ) { + appendSql( separator ); + appendSql( alias ); + appendSql( '.' ); + appendSql( columnAlias ); + separator = COMA_SEPARATOR; + } + } else { int size = 0; for ( SqlSelection sqlSelection : queryPart.getFirstQuerySpec().getSelectClause().getSqlSelections() ) { diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/jpa/FollowOnLockingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/jpa/FollowOnLockingTest.java index ef40279346..9a28a1186f 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/locking/jpa/FollowOnLockingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/locking/jpa/FollowOnLockingTest.java @@ -12,6 +12,7 @@ import java.util.concurrent.TimeUnit; import org.hibernate.dialect.CockroachDialect; import org.hibernate.dialect.HSQLDialect; +import org.hibernate.dialect.OracleDialect; import org.hibernate.query.spi.QueryImplementor; import org.hibernate.testing.jdbc.SQLStatementInspector; @@ -39,6 +40,7 @@ import static org.hibernate.jpa.SpecHints.HINT_SPEC_QUERY_TIMEOUT; @SessionFactory(useCollectingStatementInspector = true) @SkipForDialect(dialectClass = HSQLDialect.class, reason = "Seems HSQLDB doesn't cancel the query if it waits for a lock?!") @SkipForDialect(dialectClass = CockroachDialect.class, reason = "Cockroach allows the concurrent access but cancels one or both transactions at the end") +@SkipForDialect(dialectClass = OracleDialect.class, majorVersion = 11, reason = "Timeouts don't work on Oracle 11 when using a driver other than ojdbc6, but we can't test with that driver") public class FollowOnLockingTest { @Test