0 Replies Latest reply on Aug 19, 2012 7:41 AM by lukasw44

    Strange resoult in dao Jboss as 7.1 Thunder

    lukasw44

      hello

      i have got strange problem with one my function and i dont know what is wrong : /

       

      i use standard spring mvc app and i this is my function :

      @SuppressWarnings("unchecked")
          @Override
          @Transactional(readOnly=true )
          public List<TAboutAs> getFromRange(int minIndex, int maxIndex)
          {
              
              System.out.println("MIN INDEX :" + minIndex + " MAX INDEX : " + maxIndex);
          
              Query query = entityManager.createQuery("SELECT n FROM " +TAboutAs.class.getSimpleName() + " n");
              query.setFirstResult(minIndex); 
              query.setMaxResults(maxIndex);
              
              return query.getResultList();
          }
      

       

      And i have got problem because if minIndex is 0 and maxIndex is 5 i have got 5 resoults but if indexMin is 5 and indexMax is 10 i have got 10 resoults and when minIndex is 10 and maxIndex is 15 i have got 12 resoults , and minIndex 15 maxindex 20 7 resoults ??

       

      It is a bug ??  I use this function in my controller here is :


      @Autowired
          private IAboutAsDAO aboutAsDAO;
          
          @RequestMapping(IAdminConsoleActionURL.GET_ALL_ABOUT_AS_CLIPBOARD+"*")
          public @ResponseBody JsonView loadAllAboutAsClipboard(@RequestParam(value="start", defaultValue="0") int start,
                      @RequestParam(value="limit",defaultValue="5") int limit,
                      @RequestParam(value="page", defaultValue="1") int page
                  )
          {
              int stop = page * MAX_RESULTS;
          
              
              
              
              JsonView jView = new JsonView();
              jView.setSuccess(true);
              System.out.println("GET ALL JSONN start: "  + start + "stop : " + stop);
          
              
              
              List<TAboutAs> listAboutAs = null;
              listAboutAs = aboutAsDAO.getFromRange(start, stop);
              
              System.out.println("Size : " + listAboutAs.size());
              
              jView.addStaticAttribute("total", aboutAsDAO.countAll());
              jView.addStaticAttribute("data", listAboutAs);
                  
              
              return jView;
          }
      

       

      And everything is fine but not not resoults ?? i wrote the same function in Jboss 4 and everything is fine

       

      pls give me adwice or help