Author: aadamchik
Date: Fri Sep  1 09:35:33 2006
New Revision: 439371

URL: http://svn.apache.org/viewvc?rev=439371&view=rev
Log:
adding persist code to the web example

Modified:
    
incubator/cayenne/sandbox/jpa-webapp-example/src/main/java/cayenne/example/jpa/CachingEntityManagerFactory.java
    incubator/cayenne/sandbox/jpa-webapp-example/src/main/webapp/index.jsp

Modified: 
incubator/cayenne/sandbox/jpa-webapp-example/src/main/java/cayenne/example/jpa/CachingEntityManagerFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/jpa-webapp-example/src/main/java/cayenne/example/jpa/CachingEntityManagerFactory.java?rev=439371&r1=439370&r2=439371&view=diff
==============================================================================
--- 
incubator/cayenne/sandbox/jpa-webapp-example/src/main/java/cayenne/example/jpa/CachingEntityManagerFactory.java
 (original)
+++ 
incubator/cayenne/sandbox/jpa-webapp-example/src/main/java/cayenne/example/jpa/CachingEntityManagerFactory.java
 Fri Sep  1 09:35:33 2006
@@ -60,6 +60,7 @@
     public EntityManager createEntityManager() {
         if (entityManager == null) {
             entityManager = delegate.createEntityManager();
+            entityManager.getTransaction().begin();
         }
 
         return entityManager;
@@ -68,6 +69,7 @@
     public EntityManager createEntityManager(Map properties) {
         if (entityManager == null) {
             entityManager = delegate.createEntityManager(properties);
+            entityManager.getTransaction().begin();
         }
 
         return entityManager;

Modified: incubator/cayenne/sandbox/jpa-webapp-example/src/main/webapp/index.jsp
URL: 
http://svn.apache.org/viewvc/incubator/cayenne/sandbox/jpa-webapp-example/src/main/webapp/index.jsp?rev=439371&r1=439370&r2=439371&view=diff
==============================================================================
--- incubator/cayenne/sandbox/jpa-webapp-example/src/main/webapp/index.jsp 
(original)
+++ incubator/cayenne/sandbox/jpa-webapp-example/src/main/webapp/index.jsp Fri 
Sep  1 09:35:33 2006
@@ -31,6 +31,10 @@
        insert.executeUpdate();
        
        Entity1 e = em.find(Entity1.class, 1);
+       Entity1 e1 = new Entity1();
+       e1.setId(2);
+       e1.setName("yyy");
+       em.persist(e1);
 %>
 <html>
 <head>


Reply via email to