@Test public void testGadgetSortOrder() { Tab fordTab1 = jpaTabMapper.findById(fordsFirstTabId); assertEquals("", fordsFirstTabFirstGadgetId, fordTab1.getGadgets().get(0).getId()); assertEquals("", fordsFirstTabSecondGadgetId, fordTab1.getGadgets().get(1).getId()); assertEquals("", fordsFirstTabThirdGadgetId, fordTab1.getGadgets().get(2).getId()); Tab fordTab3 = jpaTabMapper.findById(fordsThirdTabId); assertEquals("", fordsThirdTabFirstGadgetId, fordTab3.getGadgets().get(0).getId()); assertEquals("", fordsThirdTabSecondGadgetId, fordTab3.getGadgets().get(1).getId()); assertEquals("", fordsThirdTabThirdGadgetId, fordTab3.getGadgets().get(2).getId()); assertEquals("", fordsThirdTabFourthGadgetId, fordTab3.getGadgets().get(3).getId()); }
public Tab findById(final Long tabId) { Query q = entityManager.createQuery( "from Tab t left join fetch t.template where t.id = :tabId and t.deleted = 'false'").setParameter( "tabId", tabId); Tab tab = (Tab) q.getSingleResult(); tab.getGadgets().size(); return tab; }
TabMapper { public Tab findById(final Long tabId) { Query q = entityManager.createQuery( "from Tab t left join fetch t.template where t.id = :tabId and t.deleted = 'false'").setParameter( "tabId", tabId); Tab tab = (Tab) q.getSingleResult(); tab.getGadgets().size(); return tab; } }
TabMapper { public Tab findById(final Long tabId) { Query q = entityManager.createQuery( "from Tab t left join fetch t.template where t.id = :tabId and t.deleted = 'false'").setParameter( "tabId", tabId); Tab tab = (Tab) q.getSingleResult(); tab.getGadgets().size(); return tab; } TabMapper(final QueryOptimizer inQueryOptimizer); }
TabMapper { public Tab findById(final Long tabId) { Query q = entityManager.createQuery( "from Tab t left join fetch t.template where t.id = :tabId and t.deleted = 'false'").setParameter( "tabId", tabId); Tab tab = (Tab) q.getSingleResult(); tab.getGadgets().size(); return tab; } TabMapper(final QueryOptimizer inQueryOptimizer); TabTemplate getTabTemplate(final String type); void setUndeleteGadgetWindowInMinutes(final int undeleteWindowInMinutes); @PersistenceContext void setEntityManager(final EntityManager inEntityManager); Tab findById(final Long tabId); TabTemplate findByGadgetId(final Long gadgetId); Tab findTabByGadgetId(final Long gadgetId); Tab findById(final Integer tabId); void flush(); void deleteGadget(final Gadget gadgetToDelete); Gadget undeleteGadget(final long gadgetId); @SuppressWarnings("unchecked") void moveGadget(final Long gadgetId, final Long sourceTabTemplateId, final Integer sourceZoneIndex,
            final Integer sourceZoneNumber, final Long targetTabTemplateId, final Integer targetZoneIndex,
            final Integer targetZoneNumber); }
TabMapper { public Tab findById(final Long tabId) { Query q = entityManager.createQuery( "from Tab t left join fetch t.template where t.id = :tabId and t.deleted = 'false'").setParameter( "tabId", tabId); Tab tab = (Tab) q.getSingleResult(); tab.getGadgets().size(); return tab; } TabMapper(final QueryOptimizer inQueryOptimizer); TabTemplate getTabTemplate(final String type); void setUndeleteGadgetWindowInMinutes(final int undeleteWindowInMinutes); @PersistenceContext void setEntityManager(final EntityManager inEntityManager); Tab findById(final Long tabId); TabTemplate findByGadgetId(final Long gadgetId); Tab findTabByGadgetId(final Long gadgetId); Tab findById(final Integer tabId); void flush(); void deleteGadget(final Gadget gadgetToDelete); Gadget undeleteGadget(final long gadgetId); @SuppressWarnings("unchecked") void moveGadget(final Long gadgetId, final Long sourceTabTemplateId, final Integer sourceZoneIndex,
            final Integer sourceZoneNumber, final Long targetTabTemplateId, final Integer targetZoneIndex,
            final Integer targetZoneNumber);  }