1 Reply Latest reply on Mar 28, 2007 7:39 PM by dmlloyd

    Question about some tags

    jcv

      Hi, could anyone post how tags <jbpm:search> and <jbpm:criteria> works?

        • 1. Re: Question about some tags
          dmlloyd

          Sure. But first I want to warn you that these tags, while present in the 3.2 jBPM web console, are not really intended to be used outside of that application, and they will not exist in jbpm4jsf; nor will they exist in the next version of the web console. I will be providing a replacement mechanism with jbpm4jsf that will be a lot simpler (I hope) and easier to use.

          The <jbpm:search> tag creates a bean that is used to track the results of a search and to configure pagination for a result set. Basically the bean contains properties that are useful to data tables, such as first row number, row count, and so forth. The "var" attribute of this tag is the name of an entry in the request-scope map into which the search bean will be stored. The "session" attribute is an EL expression which resolves to a Hibernate session.

          The <jbpm:criteria> tags work with the <jbpm:search> tag to determine what is actually to be selected from the database. Each criteria tag composes a part of a Hibernate criteria query. The query is built dynamically from a combination of these tags.

          There are two ways this tag can be used. The first way is to specify a queryClass. This tag should be your outermost one. It specifies the main class that you are querying.

          The second way is to specify a property. This attribute value represents the name of the property of the immediately enclosing tag to dereference in order to query that subcriteria. This is very similar to (though quite a bit simpler and less flexible than) how the criteria API in Hibernate works.

          The "var" attribute of the criteria tag contains the name of a request scope variable into which the Hibernate criteria object will be inserted.

          The reason that I am not going to keep these tags is that the design creates an unnecessarily tight coupling with Hibernate, which means that these tags are not compatible with other persistence strategies. Also there are a lot of subtleties with using these tags safely and properly that I did not go in to in depth. Finally the implementation ended up being much more complex than I had originally hoped for.