HHH-12098 - prep 5.3

fix test failures for mysql, mariadb, cockroachdb
This commit is contained in:
Steve Ebersole 2017-12-16 10:27:20 -06:00
parent 8eaf649aa3
commit 30db0f0a24
3 changed files with 9 additions and 7 deletions

View File

@ -187,15 +187,15 @@ public class HQLTest extends QueryTranslatorTestCase {
@Test
@RequiresDialectFeature( DialectChecks.SupportsRowValueConstructorSyntaxInInListCheck.class )
public void testRowValueConstructorSyntaxInInList() {
QueryTranslatorImpl translator = createNewQueryTranslator("from LineItem l where l.id in (?)");
QueryTranslatorImpl translator = createNewQueryTranslator("from LineItem l where l.id in (?1)");
assertInExist(" 'in' should be kept, since the dialect supports this syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in ?");
translator = createNewQueryTranslator("from LineItem l where l.id in ?1");
assertInExist(" 'in' should be kept, since the dialect supports this syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in (('a1',1,'b1'),('a2',2,'b2'))");
assertInExist(" 'in' should be kept, since the dialect supports this syntax", true,translator);
translator = createNewQueryTranslator("from Animal a where a.id in (?)");
translator = createNewQueryTranslator("from Animal a where a.id in (?1)");
assertInExist("only translated tuple has 'in' syntax", true, translator);
translator = createNewQueryTranslator("from Animal a where a.id in ?");
translator = createNewQueryTranslator("from Animal a where a.id in ?1");
assertInExist("only translated tuple has 'in' syntax", true, translator);
translator = createNewQueryTranslator("from LineItem l where l.id in (select a1 from Animal a1 left join a1.offspring o where a1.id = 1)");
assertInExist("do not translate sub-queries", true, translator);

View File

@ -33,6 +33,7 @@ import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hibernate.testing.junit4.ExtraAssertions.assertTyping;
import static org.junit.Assert.assertTrue;
@ -171,6 +172,7 @@ public class GeneratedValueTests extends BaseUnitTestCase {
final Sequence sequence = bootModel.getDatabase()
.getDefaultNamespace()
.locateSequence( Identifier.toIdentifier( "my_db_sequence" ) );
assertThat( sequence, notNullValue() );
final String[] sqlCreateStrings = new H2Dialect().getSequenceExporter().getSqlCreateStrings(
sequence,
bootModel

View File

@ -50,15 +50,15 @@ public abstract class CustomStoredProcTestSupport extends CustomSQLTestSupport {
Session s = openSession();
Query namedQuery = s.getNamedQuery( "paramhandling" );
namedQuery.setLong( 0, 10 );
namedQuery.setLong( 1, 20 );
namedQuery.setLong( 1, 10 );
namedQuery.setLong( 2, 20 );
List list = namedQuery.list();
Object[] o = ( Object[] ) list.get( 0 );
assertEquals( o[0], Long.valueOf( 10 ) );
assertEquals( o[1], Long.valueOf( 20 ) );
namedQuery = s.getNamedQuery( "paramhandling_mixed" );
namedQuery.setLong( 0, 10 );
namedQuery.setLong( 1, 10 );
namedQuery.setLong( "second", 20 );
list = namedQuery.list();
o = ( Object[] ) list.get( 0 );