From 2456b244c3dfe0edfdf64043c9a2b52c8311068d Mon Sep 17 00:00:00 2001 From: Thomas Darimont Date: Fri, 2 Aug 2013 09:31:21 +0200 Subject: [PATCH] DATAJPA-381 - Remove Hibernate specific test in PartTreeJpaQueryIntegrationTests. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Dropped the test case shouldSetTemporalQueryParameterToTimestamp(…) for DATAJPA-107 in PartTreeJpaQueryIntegrationTests as it uses Hibernate specific API, esp. API that is not available anymore in Hibernate 4.1. Original pull request: #33. --- .../PartTreeJpaQueryIntegrationTests.java | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java b/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java index c065140f7..bf3b72183 100644 --- a/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java +++ b/src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java @@ -26,18 +26,13 @@ import java.util.Arrays; import java.util.Date; import java.util.Iterator; import java.util.List; -import java.util.Map; import javax.persistence.EntityManager; -import javax.persistence.Parameter; import javax.persistence.PersistenceContext; import javax.persistence.Query; import javax.persistence.TemporalType; import org.hibernate.ejb.HibernateQuery; -import org.hibernate.engine.TypedValue; -import org.hibernate.type.TimestampType; -import org.hibernate.type.Type; import org.junit.Rule; import org.junit.Test; import org.junit.rules.ExpectedException; @@ -119,32 +114,6 @@ public class PartTreeJpaQueryIntegrationTests { assertThat(hibernateQuery.getHibernateQuery().getQueryString(), endsWith("firstname is null")); } - /** - * @throws Exception - * @see https://jira.springsource.org/browse/DATAJPA-107 - */ - @Test - public void shouldSetTemporalQueryParameterToTimestamp() throws Exception { - - Method method = UserRepository.class.getMethod("findByCreatedAtAfter", Date.class); - JpaQueryMethod queryMethod = new JpaQueryMethod(method, new DefaultRepositoryMetadata(UserRepository.class), - PersistenceProvider.fromEntityManager(entityManager)); - PartTreeJpaQuery jpaQuery = new PartTreeJpaQuery(queryMethod, entityManager); - Date date = new Date(); - Query query = jpaQuery.createQuery(new Object[] { date }); - - HibernateQuery hibernateQuery = getValue(query, "h.target.val$jpaqlQuery"); - Parameter parameter = hibernateQuery.getParameter("param0"); - Object parameterValue = hibernateQuery.getParameterValue(parameter); - Map namedParameterType = getValue(hibernateQuery.getHibernateQuery(), "namedParameters"); - TypedValue refDateParam = (TypedValue) namedParameterType.get("param0"); - - assertThat(parameter, is(notNullValue())); - assertThat(hibernateQuery.getHibernateQuery().getQueryString(), endsWith("createdAt>:param0")); - assertThat(parameterValue, is((Object) date)); - assertThat(refDateParam.getType(), is((Type) TimestampType.INSTANCE)); - } - private void testIgnoreCase(String methodName, Object... values) throws Exception { Class[] parameterTypes = new Class[values.length];