Browse Source

Fixed the dialect and using read-only transaction

Nilanjan Raychaudhuri 12 years ago
parent
commit
38e746e594

+ 1 - 1
play-java-jpa/app/models/World.java

@@ -15,7 +15,7 @@ public class World {
     public Long randomNumber;
 
     public static World findById(final Long id) throws Throwable {
-      return JPA.withTransaction(new play.libs.F.Function0<World>() {
+      return JPA.withTransaction("default", true, new play.libs.F.Function0<World>() {
         public World apply() {
             return JPA.em().find(World.class, id);
         }

+ 1 - 1
play-java-jpa/conf/META-INF/persistence.xml

@@ -7,7 +7,7 @@
         <provider>org.hibernate.ejb.HibernatePersistence</provider>
         <non-jta-data-source>DefaultDS</non-jta-data-source>
         <properties>
-            <property name="hibernate.dialect" value="org.hibernate.dialect.H2Dialect"/>
+            <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect"/>
         </properties>
     </persistence-unit>