Liran Zelkha has posted comments on this change. Change subject: core: Add JPA Java infrastructure ......................................................................
Patch Set 60: (13 comments) https://gerrit.ovirt.org/#/c/33835/60/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/HibernateTemplate.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/HibernateTemplate.java: Line 1: org.ovirt.engine.core.dao > This class should go to ...jpa package too Done Line 19: HibernateTemplate > As sonn as we implement JPA rather than Hibernate (yes very small differenc 2. Done 2.1 Why a factory? I want CDI to inject it. 3. OK. I'll add it. Line 21: protected > can this be private? Now it can. Line 23: Class<?> > Shouldn't this be Class<T>? 1. Done. 2. Some are redundant and removed Line 29: public > If we gonna create the instances of the class by the factory, the construct 1. Done. 2. Again - why a factory? Line 59: protected > If this class will not be used ppy inheritance, all protected methods shoul Done Line 60: (T) > Once type would be Class<T> the casting will become redundant as well as @S Done Line 84: Query > Using TypedQuery (JPA 2) is type-safe, so that's preferable over Query (app Done Line 107: multiResults > This methos would be redundant after starting using TypedQuery No - because in some places we use queries that don't return the type you define, but rather list of other objects (say integers) Line 115: : @SuppressWarnings("rawtypes") : public List multiResultsNoCast(Query query) { : return multiResultsNoCast(query, false); : } : : @SuppressWarnings("rawtypes") : protected List multiResultsNoCast(Query query, boolean detach) { : List entities = query.getResultList(); : : if (detach) { : for (Object entity : entities) { : em.detach(entity); : } : } : return entities; : } > since using TypedQuery "NoCast" suffix is irrelevant for the 2 methods Done Line 130: return entities; Line 131: } Line 132: Line 133: protected T singleResultNativeQuery(String sql) { Line 134: Query query = > please merge lines Done Line 135: em.createNativeQuery(sql, type); Line 136: Line 137: return singleResult(query); Line 138: } Line 137: return singleResult(query); Line 138: } Line 139: Line 140: protected List<T> multiResultsNativeQuery(String sql) { Line 141: Query query = > same Done Line 142: em.createNativeQuery(sql, type); Line 143: Line 144: return multiResults(query); Line 145: } https://gerrit.ovirt.org/#/c/33835/60/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/package-info.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/package-info.java: Line 6: package org.ovirt.engine.core.dao; Line 7: Line 8: import org.hibernate.annotations.TypeDef; Line 9: import org.hibernate.annotations.TypeDefs; Line 10: import org.ovirt.engine.core.compat.Guid;import org.ovirt.engine.core.dao.jpa.GuidUserType; > please break into 2 lines Done -- To view, visit https://gerrit.ovirt.org/33835 To unsubscribe, visit https://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: Ide82bf8cc647426e37dc42a113867c52699c3f0b Gerrit-PatchSet: 60 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Liran Zelkha <[email protected]> Gerrit-Reviewer: Allon Mureinik <[email protected]> Gerrit-Reviewer: Eli Mesika <[email protected]> Gerrit-Reviewer: Liran Zelkha <[email protected]> Gerrit-Reviewer: Moti Asayag <[email protected]> Gerrit-Reviewer: Oved Ourfali <[email protected]> Gerrit-Reviewer: Roy Golan <[email protected]> Gerrit-Reviewer: Yair Zaslavsky <[email protected]> Gerrit-Reviewer: Yevgeny Zaspitsky <[email protected]> Gerrit-Reviewer: [email protected] Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
