Skip to content

Commit f291fec

Browse files
committed
DATAJPA-703 - Added build profile for Hibernate 5.
Upgraded profiles for Hibernate 4.2 and 4.3 to the most recent releases.
1 parent 3249f37 commit f291fec

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ env:
1313
- PROFILE=hibernate-41
1414
- PROFILE=hibernate-42
1515
- PROFILE=hibernate-43
16+
- PROFILE=hibernate-5
1617

1718
sudo: false
1819

pom.xml

+20-2
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,33 @@
4343
<profile>
4444
<id>hibernate-42</id>
4545
<properties>
46-
<hibernate>4.2.11.Final</hibernate>
46+
<hibernate>4.2.19.Final</hibernate>
4747
</properties>
4848
</profile>
4949
<profile>
5050
<id>hibernate-43</id>
5151
<properties>
52-
<hibernate>4.3.4.Final</hibernate>
52+
<hibernate>4.3.9.Final</hibernate>
5353
</properties>
5454
</profile>
55+
<profile>
56+
<id>hibernate-5</id>
57+
<properties>
58+
<hibernate>5.0.0.Beta2</hibernate>
59+
</properties>
60+
</profile>
61+
<profile>
62+
<id>hibernate-5-next</id>
63+
<properties>
64+
<hibernate>5.0.0-SNAPSHOT</hibernate>
65+
</properties>
66+
<repositories>
67+
<repository>
68+
<id>jboss</id>
69+
<url>https://repository.jboss.org/nexus/content/repositories/public</url>
70+
</repository>
71+
</repositories>
72+
</profile>
5573
</profiles>
5674

5775
<dependencies>

src/test/java/org/springframework/data/jpa/repository/query/PartTreeJpaQueryIntegrationTests.java

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2011-2013 the original author or authors.
2+
* Copyright 2011-2015 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License
55
import org.springframework.aop.framework.Advised;
@@ -59,6 +59,8 @@
5959
@ContextConfiguration("classpath:infrastructure.xml")
6060
public class PartTreeJpaQueryIntegrationTests {
6161

62+
private static String PROPERTY = "h.target." + getQueryProperty();
63+
6264
@Rule public ExpectedException thrown = ExpectedException.none();
6365

6466
@PersistenceContext EntityManager entityManager;
@@ -106,12 +108,12 @@ public void recreatesQueryIfNullValueIsGiven() throws Exception {
106108

107109
Query query = jpaQuery.createQuery(new Object[] { "Matthews", new PageRequest(0, 1) });
108110

109-
HibernateQuery hibernateQuery = getValue(query, "h.target." + (isHibernate43() ? "jpqlQuery" : "val$jpaqlQuery"));
111+
HibernateQuery hibernateQuery = getValue(query, PROPERTY);
110112
assertThat(hibernateQuery.getHibernateQuery().getQueryString(), endsWith("firstname=:param0"));
111113

112114
query = jpaQuery.createQuery(new Object[] { null, new PageRequest(0, 1) });
113115

114-
hibernateQuery = getValue(query, "h.target." + (isHibernate43() ? "jpqlQuery" : "val$jpaqlQuery"));
116+
hibernateQuery = getValue(query, PROPERTY);
115117
assertThat(hibernateQuery.getHibernateQuery().getQueryString(), endsWith("firstname is null"));
116118
}
117119

@@ -141,10 +143,18 @@ private static <T> T getValue(Object source, String path) {
141143
return (T) result;
142144
}
143145

146+
private static String getQueryProperty() {
147+
return isHibernate43() || isHibernate5() ? "jpqlQuery" : "val$jpaqlQuery";
148+
}
149+
144150
private static boolean isHibernate43() {
145151
return Version.getVersionString().startsWith("4.3");
146152
}
147153

154+
private static boolean isHibernate5() {
155+
return Version.getVersionString().startsWith("5.");
156+
}
157+
148158
interface UserRepository extends Repository<User, Long> {
149159

150160
Page<User> findByFirstname(String firstname, Pageable pageable);

0 commit comments

Comments
 (0)