4 Replies Latest reply on Mar 25, 2006 10:34 AM by Emmanuel Bernard

    Runtime change of @Where clause

    Louis Coetzee Apprentice

      Hi,

      Is it possible to change the @Where clause at runtime, thus implementing some kind of polymorphic query on my collection ?

      As an example I have the following:

      @OneToMany(mappedBy = "service")
       @MapKey(name="id")
       @Where(clause="topic_type='CMS'")
       public Map<Integer,Topic> getTopics() {
       return topics;
       }


      This retrieves all the topics of type 'CMS'. At runtime I would like to set the topic_type to 'DF' for instance, which will return only the topics with topic_type 'DF'. Any suggestions would be welcome.

      Regards
      Louis