Liran Zelkha has posted comments on this change. Change subject: core: Add JPA Java infrastructure ......................................................................
Patch Set 68: (8 comments) https://gerrit.ovirt.org/#/c/33835/68/backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/jpa/AbstractJpaDao.java File backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/jpa/AbstractJpaDao.java: Line 75: /** Line 76: * Runs the query and detaches its results. Line 77: * Line 78: * @param query the {@link TypedQuery} to be run. Line 79: * @return the result <code>List</code> of the detached entities. > a note about consistency, if uses {@link ...} why not {@code ...} ? Done Line 80: */ Line 81: protected List<T> multipleResults(TypedQuery<T> query) { Line 82: final List<T> resultList = query.getResultList(); Line 83: Line 92: * Runs the query, expect a single result to be returned Line 93: * Line 94: * @param query the {@link TypedQuery} to be run Line 95: * @return A single object result of the given query. Detached state. Line 96: * Returns <code>null</code> in case of query does not return any result. > same Done Line 97: */ Line 98: protected T singleResult(TypedQuery<T> query) { Line 99: try { Line 100: final T entity = query.getSingleResult(); Line 107: Line 108: public void remove(ID id) { Line 109: final T entity = entityManager.find(entityType, id); Line 110: if (entity == null) { Line 111: LOG.warn("Trying to remove non-existent {} with id = \"{}\"", > please replace " with a single ' (this is commonly used in the project). Done Line 112: entityType.getSimpleName(), Line 113: id); Line 114: } else { Line 115: entityManager.remove(entity); https://gerrit.ovirt.org/#/c/33835/68/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseHibernateDAOTestCase.java File backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/BaseHibernateDAOTestCase.java: Line 12: import org.ovirt.engine.core.common.businessentities.BusinessEntity; Line 13: import org.springframework.test.context.transaction.TransactionConfiguration; Line 14: Line 15: @TransactionConfiguration(transactionManager = "transactionManagerJPA", defaultRollback = true) Line 16: public abstract class BaseHibernateDAOTestCase<T extends GenericDao<E, ID>, E extends BusinessEntity<ID>, ID extends Serializable> > please maintain camelCase: Done Line 17: extends BaseDAOTestCase { Line 18: Line 19: protected abstract T getDao(); Line 20: Line 55: @Test Line 56: public void testGetAll() { Line 57: List<E> result = getDao().getAll(); Line 58: Line 59: Assert.assertEquals(getAllEntitiesCount(), result.size()); > please use static import. Done Line 60: } Line 61: Line 62: /** Line 63: * Ensures that saving an entities works as expected. https://gerrit.ovirt.org/#/c/33835/68/backend/manager/modules/dal/src/test/resources/test-beans.xml File backend/manager/modules/dal/src/test/resources/test-beans.xml: Line 44: </bean> Line 45: Line 46: <bean id="engineDataSource" class="org.ovirt.engine.core.dao.BaseDAOTestCase" Line 47: factory-method="getDataSource"/> Line 48: > please remove TWS Done Line 49: <bean id="transactionManagerJPA" class="org.springframework.orm.jpa.JpaTransactionManager"> Line 50: <property name="entityManagerFactory" ref="entityManagerFactory" /> Line 51: </bean> Line 52: Line 45: Line 46: <bean id="engineDataSource" class="org.ovirt.engine.core.dao.BaseDAOTestCase" Line 47: factory-method="getDataSource"/> Line 48: Line 49: <bean id="transactionManagerJPA" class="org.springframework.orm.jpa.JpaTransactionManager"> > replace tab with spaces. Done Line 50: <property name="entityManagerFactory" ref="entityManagerFactory" /> Line 51: </bean> Line 52: Line 53: <bean id="entityManagerFactory" Line 62: <props> Line 63: <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop> Line 64: </props> Line 65: </property> Line 66: </bean> > TWS 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: 68 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
