Browse Source

Merge remote-tracking branch 'remotes/upstream/master'

Conflicts:
	frameworks/Java/play2-java/benchmark_config
	frameworks/Java/play2-java/generate_config.py
	frameworks/Java/play2-java/play2-java-ebean-hikaricp/source_code
	frameworks/Java/play2-java/play2-java-jpa-bonecp/app/controllers/Application.java
	frameworks/Java/play2-java/play2-java-jpa-bonecp/conf/routes
	frameworks/Java/play2-java/play2-java-jpa-hikaricp/README.md
	frameworks/Java/play2-java/play2-java-jpa-hikaricp/app/controllers/Application.java
	frameworks/Java/play2-java/play2-java-jpa-hikaricp/build.sbt
	frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/application.conf
	frameworks/Java/play2-java/play2-java-jpa-hikaricp/conf/routes
	frameworks/Java/play2-java/play2-java-jpa/README.md
	frameworks/Java/play2-java/play2-java-jpa/app/models/World.java
Donovan Muller 10 years ago
parent
commit
3f186de069

+ 40 - 0
frameworks/Java/play2-java/play2-java-jpa/README.md

@@ -0,0 +1,40 @@
+#Play Benchmarking Test
+
+This is the Play portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
+
+### JSON Encoding Test
+
+* [JSON test controller](app/controllers/Application.java)
+
+### Data-Store/Database Mapping Test
+
+* [Database test controller](app/controllers/Application.java)
+* [Database World test model](app/models/World.java)
+* [Database Fortune test model](app/models/Fortune.java)
+
+### Plain Text Test
+
+* [Plain text test controller](app/controllers/Application.java)
+
+## Infrastructure Software Versions
+The tests were run with:
+
+* [Java OpenJDK 1.7](http://openjdk.java.net/)
+* [Play 2.3.6](http://http://www.playframework.com/)
+
+## Test URLs
+### JSON Encoding Test
+
+* http://localhost/json
+
+### Data-Store/Database Mapping Test
+
+* http://localhost/db
+* http://localhost/queries?queries=10
+* http://localhost/fortunes
+* http://localhost/update?queries=10
+
+### Plain Text Test
+
+* http://localhost/plaintext
+

+ 38 - 0
frameworks/Java/play2-java/play2-java-jpa/app/models/World.java

@@ -0,0 +1,38 @@
+package models;
+
+import play.db.jpa.JPA;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import java.util.List;
+
+@Entity
+public class World {
+
+    @Id
+    public Long id;
+
+    @Column(name = "randomNumber")
+    public Long randomNumber;
+
+    public static World findById(final Long id) throws Throwable {
+        return JPA.withTransaction("default", true, new play.libs.F.Function0<World>() {
+            public World apply() {
+                return JPA.em().find(World.class, id);
+            }
+        });
+    }
+
+    public static List<World> save(final List<World> worlds) throws Throwable {
+        for (final World world : worlds) {
+            JPA.withTransaction("default", false, new play.libs.F.Function0<World>() {
+                public World apply() {
+                    return JPA.em().merge(world);
+                }
+            });
+        }
+
+        return worlds;
+    }
+}