0 Replies Latest reply on Sep 2, 2011 11:40 AM by charleydc5

    How to strip/ignore accents in EJB-QL

    charleydc5

      Hi folks,

      I am currently migrating some of my Java EE applications to PostgreSQL 9.0.3 and I am experiencing a serious problem with accents sensitivity.

       

      PostgreSQL is case sensitive and accent sensitive and these parameters cannot be changed. We use ejb.finder (EJB-QL) and jBoss-QL in order to run simple queries in our applications. The following statement returns a User object based on a userID and/or a user login name.

       

      For the case sensitivity, I just had to surround "u.strUserLoginName" and "?2" with a LCASE statement.

       

      Now I am looking to find a way to strip accents so the query would return "Stephane" and "Stéphane" when searching "stephane" or "stéphane".

       

      Thank you very much for help.

       

      Charles

       

       

      * @ejb.finder
       * view-type = "local"
       * query="SELECT OBJECT(u) FROM User u WHERE u.intUserId <> ?1 AND u.strUserLoginName = ?2"
       * signature = "stirq.lds.ejb.entity.User findByLoginName(java.lang.Integer intUserId, java.lang.String strUserLoginName)"