Results 1 to 3 of 3

Thread: Regarding case insensitive Search

  1. #1

    Question Regarding case insensitive Search

    Hi,
    i am using Hibernate3 with JPA using spring.
    When i search the annotated entity in normal case. It worked fine and showed sql query in the log, with following code:
    Code:
     list = this.getHibernateTemplate().findByExample(Example.create(iEntity));
    but when i added ignorecase in the example, it did worked. Even i did not show SQL in the log.

    Code:
    Example example =	Example.create(iEntity).ignoreCase().enableLike(MatchMode.EXACT);
     list = this.getHibernateTemplate().findByExample(example);

    Anyone help?

    Regards,
    shahzad

  2. #2

    Default solved

    Example example = Example.create(iEntity).ignoreCase().enableLike(Ma tchMode.EXACT);

    list = getSession()
    .createCriteria(iEntity.getClass())
    .add(example).list();

  3. #3
    Join Date
    Jun 2007
    Location
    canton,china,
    Posts
    7

    Default

    please using the Criteria class for your code!
    To the world you are just one person, but to one person you might be the whole world.
    --------------------
    http://silentwong.javaeye.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •