0 Replies Latest reply on Oct 24, 2008 10:26 AM by nimo stephan

    Strange @Out behaves other as getX in HashMap

    nimo stephan Master

      Hey,


      I have a very very strange behaviour by using @Out.


      Look at these two alternatives:


      Alternative 1:


      @Out(required=false)
      private Map<String, List<Entity>> myEntity =  new HashMap<String, List<Entity>>();



      Alternative 2:


      private Map<String, List<Entity>> myEntity =  new HashMap<String, List<Entity>>();
      public Map<String, List<Entity>> getMyEntity() { return myEntity; }



      Now I store a lot of keys in my hashMap and overwrite it with other keys.
      Using the Alternative 1, my HashMap says sporadically that it has invalid value expressions and stop putting any keys in my map.


      Using Alternative 2, the failure invalid value expressions exists only after I had really a lot of stored keys or overwrite it many times. With Alternative 1, this failure comes faster than when using alternative 2 !!!


      Is there internally a difference between the handling of @Out and its alternative getter-Method? I guess, the HashMaps rehash-Method or the equals/hashCode-Method is the reason for the invalid value expression.


      However, I have overwrite the equals/hashCode-Method in my Entity, but I had not overwritten the key String of my Map (is this the reason?).


      Any ideas?