Liran Zelkha has posted comments on this change.

Change subject: core: Add JPA Java infrastructure
......................................................................


Patch Set 20:

(7 comments)

http://gerrit.ovirt.org/#/c/33835/20/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/HibernateFacade.java
File 
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/HibernateFacade.java:

Line 11: import javax.persistence.Query;
Line 12: 
Line 13: public abstract class HibernateFacade<T, K extends Serializable> 
extends BaseDAODbFacade {
Line 14:     private static volatile EntityManagerFactory emf;
Line 15:     private static ThreadLocal<EntityManager> tl = new 
ThreadLocal<EntityManager>();
> by the way, isnnt the todo comment should be here?
Patch already submitted and verified that solves this. 
http://gerrit.ovirt.org/#/c/35793/
Line 16:     private static boolean autoCommit = true;
Line 17: 
Line 18:     // TODO: Should be injected, once we start using IoC
Line 19:     protected static EntityManager getEntityManager() {


Line 27:                     }
Line 28:                 }
Line 29:             }
Line 30:             em = emf.createEntityManager();
Line 31:             tl.set(em);
> when do we clean it from thread local?
Patch already submitted and verified that solves this. 
http://gerrit.ovirt.org/#/c/35793/
Line 32:         }
Line 33:         return em;
Line 34:     }
Line 35: 


Line 43: 
Line 44:     public void save(T entity) {
Line 45:         EntityManager em = getEntityManager();
Line 46: 
Line 47:         if (!em.getTransaction().isActive()) {
> That's what we're doing here.
Patch already submitted and verified that solves this. 
http://gerrit.ovirt.org/#/c/35793/
Line 48:             em.getTransaction().begin();
Line 49:         }
Line 50:         em.merge(entity);
Line 51:         if (autoCommit) {


Line 46: 
Line 47:         if (!em.getTransaction().isActive()) {
Line 48:             em.getTransaction().begin();
Line 49:         }
Line 50:         em.merge(entity);
> shouldn't we inspect here for ConstraintViolationException, now that we enf
What do you mean? Not familiar with this...
Line 51:         if (autoCommit) {
Line 52:             em.flush();
Line 53:             em.getTransaction().commit();
Line 54:         }


Line 49:         }
Line 50:         em.merge(entity);
Line 51:         if (autoCommit) {
Line 52:             em.flush();
Line 53:             em.getTransaction().commit();
> shouldnt we check here isActive?
Patch already submitted and verified that solves this. 
http://gerrit.ovirt.org/#/c/35793/
Line 54:         }
Line 55:     }
Line 56: 
Line 57: 


Line 63:         }
Line 64:         em.merge(entity);
Line 65:         if (autoCommit) {
Line 66:             em.flush();
Line 67:             em.getTransaction().commit();
> same question as before
Patch already submitted and verified that solves this. 
http://gerrit.ovirt.org/#/c/35793/
Line 68:         }
Line 69:     }
Line 70: 
Line 71:     @SuppressWarnings("unchecked")


Line 85:         }
Line 86:         em.remove(entity);
Line 87:         if (autoCommit) {
Line 88:             em.flush();
Line 89:             em.getTransaction().commit();
> same question as before.
Patch already submitted and verified that solves this. 
http://gerrit.ovirt.org/#/c/35793/
Line 90:         }
Line 91:     }
Line 92: 
Line 93:     public static boolean isAutoCommit() {


-- 
To view, visit http://gerrit.ovirt.org/33835
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: Ide82bf8cc647426e37dc42a113867c52699c3f0b
Gerrit-PatchSet: 20
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com>
Gerrit-Reviewer: Eli Mesika <emes...@redhat.com>
Gerrit-Reviewer: Liran Zelkha <lzel...@redhat.com>
Gerrit-Reviewer: Moti Asayag <masa...@redhat.com>
Gerrit-Reviewer: Oved Ourfali <oourf...@redhat.com>
Gerrit-Reviewer: Roy Golan <rgo...@redhat.com>
Gerrit-Reviewer: Yair Zaslavsky <yzasl...@redhat.com>
Gerrit-Reviewer: automat...@ovirt.org
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to