3 Replies Latest reply on Feb 3, 2012 8:28 AM by Adam Warski

    envers case insensitive like criteria?

    Vyacheslav Sakhno Newbie

      Will it be introduced?

       

      criteria.add(Restrictions.ilike("name", "%" + filter.get("name").toString().toLowerCase() + "%"));

      auditCriterion.add(AuditEntity...);

       

       

      package org.hibernate.criterion;.

      ...

      public class Restrictions {

      ...

      /**

                 * A case-insensitive "like", similar to Postgres <tt>ilike</tt>

                 * operator

                 *

                 * @param propertyName

                 * @param value

                 * @return Criterion

                 */

                public static Criterion ilike(String propertyName, Object value) {

                          return new IlikeExpression(propertyName, value);

                }

        • 1. Re: envers case insensitive like criteria?
          Adam Warski Master

          I don't see why not. Waiting for a pull request

           

          Adam

          • 2. Re: envers case insensitive like criteria?
            Vyacheslav Sakhno Newbie

            i actually get rid of need to do that. Have time constaints now, no time to contribute to Envers. But i've noticed that envers quiering also does not support criteria for "property of property of ... etc".

             

            I wonder why envers criteria was designed like that? Was it created for Envers Proxy implementation only?

             

            I've thought of how I'd implemented Envers like framework and come up with the idea of "runtime"/"compile time" generation of Hibernate entities for audit tables and using Hibernate Criteria classes to query them.

             

            I'm not familiar with Envers Proxy implementation and don't know whether such implementation can be implemented for generated Hibernate entities.

             

            But i think Envers Criteria code is kind of duplicating Hibernate Core Criteria code.

             

            Please let me know if you see lack and difficulties in implementation of "runtime"/"compile time" generation of Hibernate entities.

            • 3. Re: envers case insensitive like criteria?
              Adam Warski Master

              Sure, the main difficulty is that there are no normal-style relations. Given an audited version of entity A, at revision X it can relate to entity B1, and at revision Y it can relate to B2. That's why creating multi-level queries is hard.

               

              Adam