2 Replies Latest reply on Jun 28, 2012 8:40 AM by dzhelyazkov

    AS7 uses unordered Set for storing object ids

    dzhelyazkov

      Hi all,

      I have EJB 2.x BMP beans that have ejbFind methods. The use "order by" so I get the objects sorted by the DBMS.

      It was ok in JBoss 4.2 but in 7.1.x it does not work. I lookes into the sources and saw that HashSet is used to store the ids of the found records.

      Is this behavior by the standart - no ordering is guaranteed, or just a simple bug?

      How can I report this?

       

      File is: /ejb3/src/main/java/org/jboss/as/ejb3/component/entity/interceptors/EntityBeanHomeFinderInterceptorFactory.java

      protected Object prepareResults(final InterceptorContext context, final Object result, final EntityBeanComponent component) throws Exception {
              switch (returnType) {
                  case COLLECTION: {
                      Collection keys = (Collection) result;
                      final Set results = new HashSet();
                      if (keys != null) {
                          for (Object key : keys) {
                              results.add(getLocalObject(key));
                          }
                      }
                      return results;
                  }
      

       

      thanks,

       

      Daniel