Skip to content

Commit 1e80b6e

Browse files
authored
Merge pull request #1114 from codeborne/upgrade-hibernate
Upgrade hibernate
2 parents 637e717 + 50f5b13 commit 1e80b6e

38 files changed

+306
-148
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ support/textmate
8484
samples-and-tests/yabe/logs
8585
samples-and-tests/yabe/test-result
8686
samples-and-tests/yabe/tmp
87+
samples-and-tests/yabe/modules
8788
*.ser
8889
modules/cobertura/lib
8990
modules/scala/lib/play-scala.jar

.travis.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@ addons:
1313
hosts:
1414
- myshorthost
1515
hostname: myshorthost
16+
1617
script: ant -buildfile ./framework/build.xml test
17-
after_failure:
18-
cat ./samples-and-tests/just-test-cases/test-result/*.failed.html
19-
cat ./samples-and-tests/forum/test-result/*.failed.html
20-
cat ./samples-and-tests/zencontact/test-result/*.failed.html
21-
cat ./samples-and-tests/jobboard/test-result/*.failed.html
22-
cat ./samples-and-tests/yabe/test-result/*.failed.html
18+
19+
after_failure:
20+
find samples-and-tests -name '*.failed.html' -exec echo {} \; -exec cat {} \;
21+
2322
notifications:
2423
webhooks:
2524
urls:

documentation/manual/releases/release1.0.x/releasenotes-1.0.1.textile

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Now all dynamic expressions are escaped by the template engine to avoid XSS secu
1212

1313
bc. ${title} --> <h1>Title</h1>
1414

15-
If you really want to display it in an unescaped way, you need to explicitely call the @raw()@ method:
15+
If you really want to display it in an unescaped way, you need to explicitly call the @raw()@ method:
1616

1717
bc. ${title.raw()} --> <h1>Title</h1>
1818

@@ -119,7 +119,7 @@ bc. public class User {
119119

120120
h2. <a>Test runner update</a>
121121

122-
We’ve updated Selenium to the 1.0.1 final version and improved the UI. Selenium tests now run in fullscreen. And some new functionality like the "Run all tests" have been added.
122+
We’ve updated Selenium to the 1.0.1 final version and improved the UI. Selenium tests now run in full screen. And some new functionality like the "Run all tests" have been added.
123123

124124
!images/selenium-fullscreen!
125125

documentation/manual/releases/release1.0.x/releasenotes.textile

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Now all dynamic expressions are escaped by the template engine to avoid XSS secu
1212

1313
bc. ${title} --> &lt;h1&gt;Title&lt;/h1&gt;
1414

15-
If you really want to display it in an unescaped way, you need to explicitely call the **raw()** method:
15+
If you really want to display it in an unescaped way, you need to explicitly call the **raw()** method:
1616

1717
bc. ${title.raw()} --> <h1>Title</h1>
1818

@@ -71,7 +71,7 @@ bc. public static void save(User user) {
7171
user.save(); // ok with 1.0.1
7272
}
7373

74-
Of course as this feature can break existing applications it is not enabled by default. You can enable it by adding the followin line to your **application.conf** file:
74+
Of course as this feature can break existing applications it is not enabled by default. You can enable it by adding the following line to your **application.conf** file:
7575

7676
bc. future.bindJPAObjects=true
7777

@@ -119,7 +119,7 @@ bc. public class User {
119119

120120
h2. <a>Test runner update</a>
121121

122-
We've updated selenium to the 1.0.1 final version and improved the UI. Selenium tests now run in fullscreen. And some new functionalities like the "Run all tests" have been added.
122+
We've updated selenium to the 1.0.1 final version and improved the UI. Selenium tests now run in full screen. And some new functionalities like the "Run all tests" have been added.
123123

124124
!images/selenium-fullscreen!
125125

documentation/manual/templates.textile

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ All dynamic expressions are escaped by the template engine to avoid XSS security
8080

8181
bc. ${title} --> &lt;h1&gt;Title&lt;/h1&gt;
8282

83-
If you really want to display it in an unescaped way, you need to explicitely call the @raw()@ method:
83+
If you really want to display it in an unescaped way, you need to explicitly call the @raw()@ method:
8484

8585
bc. ${title.raw()} --> <h1>Title</h1>
8686

framework/dependencies.yml

+10-9
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,16 @@ require: &allDependencies
4545
- org.bouncycastle -> bcprov-jdk15 1.46
4646
- org.codehaus.groovy -> groovy-all 2.4.11
4747
- org.eclipse.jdt.core 3.12.3
48-
- org.hibernate -> hibernate-core 4.2.19.Final
49-
- org.hibernate -> hibernate-commons-annotations 4.0.2.Final
50-
- org.hibernate -> hibernate-entitymanager 4.2.19.Final
51-
- org.hibernate -> hibernate-validator 4.1.0.Final
52-
- org.hibernate -> jboss-logging 3.1.0.GA
53-
- org.hibernate -> jboss-transaction-api_1.1_spec 1.0.1.Final
54-
- org.hibernate.javax.persistence -> hibernate-jpa-2.0-api 1.0.1.Final
55-
- org.hibernate -> hibernate-c3p0 4.2.19.Final
56-
- org.hibernate -> hibernate-ehcache 4.2.19.Final
48+
- org.hibernate -> hibernate-core 5.2.10.patched
49+
- org.hibernate.common -> hibernate-commons-annotations 5.0.1.Final
50+
- org.hibernate -> hibernate-entitymanager 5.2.10.Final
51+
- org.hibernate -> hibernate-validator 5.4.1.Final
52+
- org.jboss.logging -> jboss-logging 3.3.0.Final
53+
- org.jboss.spec.javax.transaction -> jboss-transaction-api_1.2_spec 1.0.1.Final
54+
- org.hibernate.javax.persistence -> hibernate-jpa-2.1-api 1.0.0.Final
55+
- com.fasterxml -> classmate 1.3.3
56+
- org.hibernate -> hibernate-c3p0 5.2.10.Final
57+
- org.hibernate -> hibernate-ehcache 5.2.10.Final
5758
- com.mchange -> mchange-commons-java 0.2.12
5859
- org.javassist -> javassist 3.21.0-GA
5960
- io.netty -> netty 3.10.6.Final

framework/lib/classmate-1.3.3.jar

63.5 KB
Binary file not shown.
-42.3 KB
Binary file not shown.
11.4 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
-4.48 MB
Binary file not shown.
6.31 MB
Binary file not shown.
-135 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-59.3 KB
Binary file not shown.
65.2 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.

framework/patches/hibernate-4.2.19-patch-play.README

-6
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
----
2+
Download Hibernate 5.2.10.Final source code, apply the patch, and build with gradle (tip use export GRADLE_OPTS=-Xmx1G -XX:MaxPermSize=512m)
3+
----
4+
5+
DRY RUN -> patch --dry-run -p1 -i hibernate-5.2.10-patch-play.patch
6+
APPLY -> patch -p1 -i hibernate-5.2.10-patch-play.patch

framework/src/play/classloading/ApplicationClassloader.java

+12-6
Original file line numberDiff line numberDiff line change
@@ -255,15 +255,21 @@ public InputStream getResourceAsStream(String name) {
255255

256256
@Override
257257
public URL getResource(String name) {
258-
for (VirtualFile vf : Play.javaPath) {
259-
VirtualFile res = vf.child(name);
260-
if (res != null && res.exists()) {
261-
try {
258+
try {
259+
for (VirtualFile vf : Play.javaPath) {
260+
VirtualFile res = vf.child(name);
261+
if (res != null && res.exists()) {
262262
return res.getRealFile().toURI().toURL();
263-
} catch (MalformedURLException ex) {
264-
throw new UnexpectedException(ex);
265263
}
266264
}
265+
if (Play.configuration.getProperty("play.bytecodeCache", "true").equals("true")) {
266+
File f = new File(Play.tmpDir, "classes/" + name);
267+
if (f.exists()) {
268+
return f.toURI().toURL();
269+
}
270+
}
271+
} catch (MalformedURLException ex) {
272+
throw new UnexpectedException(ex);
267273
}
268274
return super.getResource(name);
269275
}

framework/src/play/db/DB.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import javax.sql.RowSet;
1616
import javax.sql.rowset.CachedRowSet;
1717

18+
import org.hibernate.jpa.HibernateEntityManager;
1819
import org.hibernate.internal.SessionImpl;
1920

2021
import com.sun.rowset.CachedRowSetImpl;
@@ -177,7 +178,7 @@ public static void close(String name) {
177178
public static Connection getConnection(String name) {
178179
try {
179180
if (JPA.isEnabled()) {
180-
return ((SessionImpl) ((org.hibernate.ejb.EntityManagerImpl) JPA.em(name)).getSession()).connection();
181+
return ((SessionImpl) ((HibernateEntityManager) JPA.em(name)).getSession()).connection();
181182
}
182183

183184
Connection localConnection = getLocalConnection(name);

framework/src/play/db/jpa/Blob.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import org.hibernate.HibernateException;
1313
import org.hibernate.engine.spi.SessionImplementor;
14+
import org.hibernate.engine.spi.SharedSessionContractImplementor;
1415
import org.hibernate.type.StringType;
1516
import org.hibernate.usertype.UserType;
1617

@@ -114,17 +115,17 @@ public int hashCode(Object o) throws HibernateException {
114115
}
115116

116117
@Override
117-
public Object nullSafeGet(ResultSet resultSet, String[] names, SessionImplementor sessionImplementor, Object o) throws HibernateException, SQLException {
118-
String val = (String) StringType.INSTANCE.nullSafeGet(resultSet, names[0], sessionImplementor, o);
118+
public Object nullSafeGet(ResultSet rs, String[] names, SharedSessionContractImplementor session, Object owner) throws HibernateException, SQLException {
119+
String val = (String) StringType.INSTANCE.nullSafeGet(rs, names[0], session, owner);
119120
return new Blob(val);
120121
}
121122

122123
@Override
123-
public void nullSafeSet(PreparedStatement ps, Object o, int i, SessionImplementor sessionImplementor) throws HibernateException, SQLException {
124-
if(o != null) {
125-
ps.setString(i, encode((Blob) o));
124+
public void nullSafeSet(PreparedStatement ps, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
125+
if (value != null) {
126+
ps.setString(index, encode((Blob) value));
126127
} else {
127-
ps.setNull(i, Types.VARCHAR);
128+
ps.setNull(index, Types.VARCHAR);
128129
}
129130
}
130131

0 commit comments

Comments
 (0)