Fix ProcedureParameterTests

This commit is contained in:
Christian Beikov 2022-02-15 11:40:41 +01:00
parent 9b6ddc8c0b
commit b9dca52ecc
1 changed files with 66 additions and 67 deletions

View File

@ -32,74 +32,73 @@ import static org.assertj.core.api.Assertions.assertThat;
* @author Steve Ebersole * @author Steve Ebersole
*/ */
@Jpa @Jpa
@NotImplementedYet( strict = false, reason = "This is something Christian is working on" )
@RequiresDialect( H2Dialect.class ) @RequiresDialect( H2Dialect.class )
@JiraKey("https://hibernate.atlassian.net/browse/HHH-11447") @JiraKey("https://hibernate.atlassian.net/browse/HHH-11447")
public class ProcedureParameterTests { public class ProcedureParameterTests {
//
// @Test @Test
// public void testRegisteredParameter(EntityManagerFactoryScope scope) { public void testRegisteredParameter(EntityManagerFactoryScope scope) {
// // locate takes 2 parameters with an optional 3rd. Here, we will call it // locate takes 2 parameters with an optional 3rd. Here, we will call it
// // registering and binding all 3 parameters // registering and binding all 3 parameters
// scope.inTransaction( (em) -> { scope.inTransaction( (em) -> {
// final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" ); final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" );
// query.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); query.setHint( QueryHints.CALLABLE_FUNCTION, "true" );
// // search-tring // search-tring
// query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN );
// // source-string // source-string
// query.registerStoredProcedureParameter( 2, String.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 2, String.class, ParameterMode.IN );
// // start-position // start-position
// query.registerStoredProcedureParameter( 3, Integer.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 3, Integer.class, ParameterMode.IN );
//
// query.setParameter( 1, "." ); query.setParameter( 1, "." );
// query.setParameter( 2, "org.hibernate.query" ); query.setParameter( 2, "org.hibernate.query" );
// query.setParameter( 3, 5 ); query.setParameter( 3, 5 );
//
// final Object singleResult = query.getSingleResult(); final Object singleResult = query.getSingleResult();
// assertThat( singleResult ).isInstanceOf( Integer.class ); assertThat( singleResult ).isInstanceOf( Integer.class );
// assertThat( singleResult ).isEqualTo( 14 ); assertThat( singleResult ).isEqualTo( 14 );
// } ); } );
//
// // explicit start-position baseline for no-arg // explicit start-position baseline for no-arg
//
// scope.inTransaction( (em) -> { scope.inTransaction( (em) -> {
// final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" ); final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" );
// query.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); query.setHint( QueryHints.CALLABLE_FUNCTION, "true" );
// // search-string // search-string
// query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN );
// // source-string // source-string
// query.registerStoredProcedureParameter( 2, String.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 2, String.class, ParameterMode.IN );
// // start-position // start-position
// query.registerStoredProcedureParameter( 3, Integer.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 3, Integer.class, ParameterMode.IN );
//
// query.setParameter( 1, "." ); query.setParameter( 1, "." );
// query.setParameter( 2, "org.hibernate.query" ); query.setParameter( 2, "org.hibernate.query" );
// query.setParameter( 3, 0 ); query.setParameter( 3, 0 );
//
// final Object singleResult = query.getSingleResult(); final Object singleResult = query.getSingleResult();
// assertThat( singleResult ).isInstanceOf( Integer.class ); assertThat( singleResult ).isInstanceOf( Integer.class );
// assertThat( singleResult ).isEqualTo( 4 ); assertThat( singleResult ).isEqualTo( 4 );
// } ); } );
// } }
//
// @Test @Test
// public void testUnRegisteredParameter(EntityManagerFactoryScope scope) { public void testUnRegisteredParameter(EntityManagerFactoryScope scope) {
// // next, skip start-position registration which should trigger the // next, skip start-position registration which should trigger the
// // function's default value defined on the database to be applied // function's default value defined on the database to be applied
// scope.inTransaction( (em) -> { scope.inTransaction( (em) -> {
// final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" ); final StoredProcedureQuery query = em.createStoredProcedureQuery("locate" );
// query.setHint( QueryHints.CALLABLE_FUNCTION, "true" ); query.setHint( QueryHints.CALLABLE_FUNCTION, "true" );
// // search-string // search-string
// query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 1, String.class, ParameterMode.IN );
// // source-string // source-string
// query.registerStoredProcedureParameter( 2, String.class, ParameterMode.IN ); query.registerStoredProcedureParameter( 2, String.class, ParameterMode.IN );
//
// query.setParameter( 1, "." ); query.setParameter( 1, "." );
// query.setParameter( 2, "org.hibernate.query" ); query.setParameter( 2, "org.hibernate.query" );
//
// final Object singleResult = query.getSingleResult(); final Object singleResult = query.getSingleResult();
// assertThat( singleResult ).isInstanceOf( Integer.class ); assertThat( singleResult ).isInstanceOf( Integer.class );
// assertThat( singleResult ).isEqualTo( 4 ); assertThat( singleResult ).isEqualTo( 4 );
// } ); } );
// } }
} }