2 Replies Latest reply on Sep 7, 2006 5:58 AM by Urs Wagner

    Query parameter is modified and return as null

    Urs Wagner Novice

      I use a stateless session bean this method.

      In this query the first parameter textKey is set to password.

      The query returns a label object with textKey field value null.

      It is completly unlogical, the property is different to the search property but an object is found.

      And as consequence somewhere afte the call of the method the database field texkey will set to null.


      public Label findByTextKey(String textKey, Language language) {

      Label label = (Label) labelsMap.get(textKey);
      if (label == null) {
      Query query = manager.createQuery(
      "from Label l where l.textKey = :textKey and l.language = :language");
      query.setParameter("textKey", textKey);
      query.setParameter("language", language);
      try {
      label = ((Label) query.getSingleResult());
      labelsMap.put(textKey, label);
      }
      catch (NoResultException nre) {

      }
      }

      return label;
      }