HHH-13554 : QueryAndSQLTest.testNativeQueryWithFormulaAttributeWithoutAlias() fails on Oracle, MSSQL, Sybase, DB2

This commit is contained in:
Gail Badner 2019-08-09 13:48:26 -07:00
parent 6841012f78
commit 2a154cb583
1 changed files with 10 additions and 2 deletions

View File

@ -32,7 +32,6 @@ import org.hibernate.dialect.SybaseDialect;
import org.hibernate.dialect.function.SQLFunction;
import org.hibernate.stat.Statistics;
import org.hibernate.type.StandardBasicTypes;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.SkipForDialect;
import org.hibernate.testing.TestForIssue;
import org.hibernate.testing.junit4.BaseCoreFunctionalTestCase;
@ -97,7 +96,16 @@ public class QueryAndSQLTest extends BaseCoreFunctionalTestCase {
@Test
@SkipForDialect(value = AbstractHANADialect.class, comment = "invalid name of function or procedure: SYSDATE")
public void testNativeQueryWithFormulaAttributeWithoutAlias() {
String sql = "select TABLE_NAME , sysdate() from all_tables where TABLE_NAME = 'AUDIT_ACTIONS' ";
SQLFunction dateFunction = getDialect().getFunctions().get( "current_date" );
String dateFunctionRendered = dateFunction.render(
null,
java.util.Collections.EMPTY_LIST,
sessionFactory()
);
String sql = String.format(
"select TABLE_NAME , %s from all_tables where TABLE_NAME = 'AUDIT_ACTIONS' ",
dateFunctionRendered
);
Session s = openSession();
s.beginTransaction();
s.createSQLQuery( sql ).addEntity( "t", AllTables.class ).list();