Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Upgrade hibernate #1114

Merged
merged 6 commits into from
May 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ support/textmate
samples-and-tests/yabe/logs
samples-and-tests/yabe/test-result
samples-and-tests/yabe/tmp
samples-and-tests/yabe/modules
*.ser
modules/cobertura/lib
modules/scala/lib/play-scala.jar
Expand Down
11 changes: 5 additions & 6 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ addons:
hosts:
- myshorthost
hostname: myshorthost

script: ant -buildfile ./framework/build.xml test
after_failure:
cat ./samples-and-tests/just-test-cases/test-result/*.failed.html
cat ./samples-and-tests/forum/test-result/*.failed.html
cat ./samples-and-tests/zencontact/test-result/*.failed.html
cat ./samples-and-tests/jobboard/test-result/*.failed.html
cat ./samples-and-tests/yabe/test-result/*.failed.html

after_failure:
find samples-and-tests -name '*.failed.html' -exec echo {} \; -exec cat {} \;

notifications:
webhooks:
urls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Now all dynamic expressions are escaped by the template engine to avoid XSS secu

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

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

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

Expand Down Expand Up @@ -119,7 +119,7 @@ bc. public class User {

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

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.
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.

!images/selenium-fullscreen!

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Now all dynamic expressions are escaped by the template engine to avoid XSS secu

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

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

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

Expand Down Expand Up @@ -71,7 +71,7 @@ bc. public static void save(User user) {
user.save(); // ok with 1.0.1
}

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:
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:

bc. future.bindJPAObjects=true

Expand Down Expand Up @@ -119,7 +119,7 @@ bc. public class User {

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

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.
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.

!images/selenium-fullscreen!

Expand Down
2 changes: 1 addition & 1 deletion documentation/manual/templates.textile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ All dynamic expressions are escaped by the template engine to avoid XSS security

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

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

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

Expand Down
19 changes: 10 additions & 9 deletions framework/dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,16 @@ require: &allDependencies
- org.bouncycastle -> bcprov-jdk15 1.46
- org.codehaus.groovy -> groovy-all 2.4.11
- org.eclipse.jdt.core 3.12.3
- org.hibernate -> hibernate-core 4.2.19.Final
- org.hibernate -> hibernate-commons-annotations 4.0.2.Final
- org.hibernate -> hibernate-entitymanager 4.2.19.Final
- org.hibernate -> hibernate-validator 4.1.0.Final
- org.hibernate -> jboss-logging 3.1.0.GA
- org.hibernate -> jboss-transaction-api_1.1_spec 1.0.1.Final
- org.hibernate.javax.persistence -> hibernate-jpa-2.0-api 1.0.1.Final
- org.hibernate -> hibernate-c3p0 4.2.19.Final
- org.hibernate -> hibernate-ehcache 4.2.19.Final
- org.hibernate -> hibernate-core 5.2.10.patched
- org.hibernate.common -> hibernate-commons-annotations 5.0.1.Final
- org.hibernate -> hibernate-entitymanager 5.2.10.Final
- org.hibernate -> hibernate-validator 5.4.1.Final
- org.jboss.logging -> jboss-logging 3.3.0.Final
- org.jboss.spec.javax.transaction -> jboss-transaction-api_1.2_spec 1.0.1.Final
- org.hibernate.javax.persistence -> hibernate-jpa-2.1-api 1.0.0.Final
- com.fasterxml -> classmate 1.3.3
- org.hibernate -> hibernate-c3p0 5.2.10.Final
- org.hibernate -> hibernate-ehcache 5.2.10.Final
- com.mchange -> mchange-commons-java 0.2.12
- org.javassist -> javassist 3.21.0-GA
- io.netty -> netty 3.10.6.Final
Expand Down
Binary file added framework/lib/classmate-1.3.3.jar
Binary file not shown.
Binary file removed framework/lib/hibernate-c3p0-4.2.19.Final.jar
Binary file not shown.
Binary file added framework/lib/hibernate-c3p0-5.2.10.Final.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed framework/lib/hibernate-core-4.2.19.Final.jar
Binary file not shown.
Binary file added framework/lib/hibernate-core-5.2.10.patched.jar
Binary file not shown.
Binary file removed framework/lib/hibernate-ehcache-4.2.19.Final.jar
Binary file not shown.
Binary file added framework/lib/hibernate-ehcache-5.2.10.Final.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed framework/lib/hibernate-jpa-2.0-api-1.0.1.Final.jar
Binary file not shown.
Binary file not shown.
Binary file removed framework/lib/hibernate-validator-4.1.0.Final.jar
Binary file not shown.
Binary file not shown.
Binary file removed framework/lib/jboss-logging-3.1.0.GA.jar
Binary file not shown.
Binary file added framework/lib/jboss-logging-3.3.0.Final.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
6 changes: 0 additions & 6 deletions framework/patches/hibernate-4.2.19-patch-play.README

This file was deleted.

6 changes: 6 additions & 0 deletions framework/patches/hibernate-5.2.10-patch-play.README
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
----
Download Hibernate 5.2.10.Final source code, apply the patch, and build with gradle (tip use export GRADLE_OPTS=-Xmx1G -XX:MaxPermSize=512m)
----

DRY RUN -> patch --dry-run -p1 -i hibernate-5.2.10-patch-play.patch
APPLY -> patch -p1 -i hibernate-5.2.10-patch-play.patch
18 changes: 12 additions & 6 deletions framework/src/play/classloading/ApplicationClassloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,15 +255,21 @@ public InputStream getResourceAsStream(String name) {

@Override
public URL getResource(String name) {
for (VirtualFile vf : Play.javaPath) {
VirtualFile res = vf.child(name);
if (res != null && res.exists()) {
try {
try {
for (VirtualFile vf : Play.javaPath) {
VirtualFile res = vf.child(name);
if (res != null && res.exists()) {
return res.getRealFile().toURI().toURL();
} catch (MalformedURLException ex) {
throw new UnexpectedException(ex);
}
}
if (Play.configuration.getProperty("play.bytecodeCache", "true").equals("true")) {
File f = new File(Play.tmpDir, "classes/" + name);
if (f.exists()) {
return f.toURI().toURL();
}
}
} catch (MalformedURLException ex) {
throw new UnexpectedException(ex);
}
return super.getResource(name);
}
Expand Down
3 changes: 2 additions & 1 deletion framework/src/play/db/DB.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import javax.sql.RowSet;
import javax.sql.rowset.CachedRowSet;

import org.hibernate.jpa.HibernateEntityManager;
import org.hibernate.internal.SessionImpl;

import com.sun.rowset.CachedRowSetImpl;
Expand Down Expand Up @@ -177,7 +178,7 @@ public static void close(String name) {
public static Connection getConnection(String name) {
try {
if (JPA.isEnabled()) {
return ((SessionImpl) ((org.hibernate.ejb.EntityManagerImpl) JPA.em(name)).getSession()).connection();
return ((SessionImpl) ((HibernateEntityManager) JPA.em(name)).getSession()).connection();
}

Connection localConnection = getLocalConnection(name);
Expand Down
13 changes: 7 additions & 6 deletions framework/src/play/db/jpa/Blob.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SessionImplementor;
import org.hibernate.engine.spi.SharedSessionContractImplementor;
import org.hibernate.type.StringType;
import org.hibernate.usertype.UserType;

Expand Down Expand Up @@ -114,17 +115,17 @@ public int hashCode(Object o) throws HibernateException {
}

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

@Override
public void nullSafeSet(PreparedStatement ps, Object o, int i, SessionImplementor sessionImplementor) throws HibernateException, SQLException {
if(o != null) {
ps.setString(i, encode((Blob) o));
public void nullSafeSet(PreparedStatement ps, Object value, int index, SharedSessionContractImplementor session) throws HibernateException, SQLException {
if (value != null) {
ps.setString(index, encode((Blob) value));
} else {
ps.setNull(i, Types.VARCHAR);
ps.setNull(index, Types.VARCHAR);
}
}

Expand Down
Loading