HHH-12098 - prep 5.3

fix test failures for mysql, mariadb, cockroachdb
This commit is contained in:
Steve Ebersole 2017-12-16 13:18:31 -06:00
parent 30db0f0a24
commit 9529f4f0a2
2 changed files with 24 additions and 8 deletions

View File

@ -29,6 +29,7 @@ import org.hibernate.id.enhanced.TableGenerator;
import org.hibernate.mapping.PersistentClass;
import org.hibernate.mapping.RootClass;
import org.hibernate.testing.RequiresDialect;
import org.hibernate.testing.junit4.BaseUnitTestCase;
import org.junit.Test;
@ -44,6 +45,7 @@ import static org.junit.Assert.assertTrue;
*
* @author Steve Ebersole
*/
@RequiresDialect( value = H2Dialect.class, comment = "Really, these tests are independent of the underlying database - but Dialects that do not support sequences cause some assertions to erroneously fail" )
public class GeneratedValueTests extends BaseUnitTestCase {
@Test
public void baseline() {

View File

@ -17,14 +17,18 @@ import org.hibernate.HibernateException;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.Transaction;
import org.hibernate.engine.query.ParameterRecognitionException;
import org.hibernate.procedure.ProcedureCall;
import org.hibernate.test.sql.hand.Employment;
import org.hibernate.test.sql.hand.Organization;
import org.hibernate.test.sql.hand.Person;
import com.arjuna.ats.internal.jdbc.drivers.modifiers.list;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
/**
* Abstract test case defining tests of stored procedure support.
@ -56,17 +60,27 @@ public abstract class CustomStoredProcTestSupport extends CustomSQLTestSupport {
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( 1, 10 );
namedQuery.setLong( "second", 20 );
list = namedQuery.list();
o = ( Object[] ) list.get( 0 );
assertEquals( o[0], Long.valueOf( 10 ) );
assertEquals( o[1], Long.valueOf( 20 ) );
s.close();
}
@Test
public void testMixedParameterHandling() throws HibernateException, SQLException {
inTransaction(
session -> {
try {
session.getNamedQuery( "paramhandling_mixed" );
fail( "Expecting an exception" );
}
catch (ParameterRecognitionException expected) {
// expected outcome
}
catch (Exception other) {
throw new AssertionError( "Expecting a ParameterRecognitionException, but encountered " + other.getClass().getSimpleName(), other );
}
}
);
}
@Test
public void testEntityStoredProcedure() throws HibernateException, SQLException {
Session s = openSession();