Character « Query « JPA Q&A





1. Problem with JPA Order By and swedish characters    stackoverflow.com

I am experiencing a problem with order by in a JPA-query. The query is trivial and behaves as expected in an sql-client. The problem is the swedish characters å, ä and ...

2. Escaping the colon character ':' in JPA queries    stackoverflow.com

I'm trying to run a native query through JPA that uses a ':' character. The particular instance is using a MySQL user variable in the query:

SELECT foo, bar, baz, 
  ...

3. hibernate query returns only first character of string    stackoverflow.com

When I run a query like this in oracle 10g using sqldeveloper, it runs fine.

select 'Canada' as "country", emp.name as "name" from emp.
Gives me the name and country. When ...

4. strange hibernate createSQLQuery returns a CHAR|Character but String    stackoverflow.com

I am using hibernate createSQLQuery, but it returns only first char.

tableName = 'select code, name from airports where excludeFromSearch = 0 order by name';
s.createSQLQuery(tableName).list();
I am using:
  • Mysql
  • hibernate 3.2
Snapshot: enter ...</p></div></td></tr><tr><td><div class='articleProductElement'><h3 class='articleProductElementTitle'>5. <a href='http://stackoverflow.com/questions/6421371/how-to-select-only-first-characters-from-sql-column-with-hibernate-criteria'>how to select only first 10 characters from sql column with Hibernate Criteria</a><span class='articleProductElementHost'>    stackoverflow.com</span></h3><p class='articleProductElementParagraph'>I have a column in mysql

6. match query in hibernate for two characters    stackoverflow.com

I am using Hibernate with mysql I have a keyword in my java for which i need to retrieve record from MySQL

    Restrictions.like("resume Text", keyword, Match Mode.ANYWHERE));
when i ...

7. Hibernate criteria query for Oracle special characters    coderanch.com

Hi there, I have a Criteria query in Hibernate. In some cases the query column parameter data has actual Oracle substitution variable ampersand (&). eg) name= "AB&C" Due to this the query blows when interacting with an Oracle database. How can this be handled in the Hibernate layer. Let me know your thoughts. Regards, M

8. Escape HQL Like special characters    coderanch.com

9. Like character escaping    forum.hibernate.org

Can anyone please explain how to work with the 'escape' keyword in HQL? I am trying to escape the % character in LIKE clause, For example: String hql = from Cat where cat_name LIKE :param; query.setParam(param,%) ; I was unable to do this unless I rite specific code for each DB Thank you!





10. createSQLQuery returns only first character    forum.hibernate.org

Dear all, I am new to hibernate and have only been working on this for 2 months or so. Recently I hit this problem which I feel really strange. The following is my code : Code: String queryStr = "SELECT a.assignmentID, a.assignmentName, a.assignmentStatus, b.accountCompany " + ...

11. Hibernate does not support query using Chinese character?    forum.hibernate.org

Database: oracle9. when I execute the following: from mvc_hibernate2.provinces.Provinces as cat where cat.province_name='A' it is ok. But if I change 'A' to a Chinese character (for example: '') or a Chinese string, it will complain as below: org.hibernate.QueryException: expecting ''', found 'a' [from mvc_hibernate2.provinces.Provinces as cat where cat.province_name=''] at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:165) at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83) at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:414) at org.hib.... why? eager for help...(Chinese hibernate ...

12. Special Characters errors when making queries dynamically    forum.hibernate.org

Hi, my problem is as follow : I create a query dynamically, for example String texto = "VW '97 (L/V)" String query = "from ar.com.csi.gestioncomercial.model.Producto producto"; query = query + " where producto.description >= '" + texto + "'" + "ORDER BY producto.description"; Then I call the method listByCriteria(String, int), showed below, with query and 50 as parameters. When the line ...

13. Underscore character is ignored in query using criteria    forum.hibernate.org

The underscore character "_" is ignored in our search criteria. For example a search for "BANK_1" returns "BANK 1" ignoring the underscore. Search criteria: criteria.add(Restrictions.ilike("nameTx", searchName, MatchMode.ANYWHERE)); searchName = "BANK_1" We are using hibernate 3. Can anyone provide any insight as to why the underscore is ignored ? Any suggestions will be appreciated. Thank you.

14. Like clause and "%" characters in query    forum.hibernate.org

16. Using Escape Character with "LIKE" Criteria Query    forum.hibernate.org

List topicList = getSession().createCriteria(Topic.class) .add(Expression.like("topicShortName", topicShortName, MatchMode.START)) ...





18. Problem with SQL query returning CHAR(20) as Character    forum.hibernate.org

Hello, I'm having trouble with a simple SQL query run through Hibernate. It looks like this: List results = session.createSQLQuery("SELECT name FROM table").list(); "name" is a CHAR(20) column in a DB2 database. What Hibernate returns is a list of java.lang.Characters - the names are truncated and only the first character is returned. Right now I'm working around this by calling addScalar("name", ...

19. Finding entities with ISO-8859-1 characters    forum.hibernate.org

Hi, I would like to query data without explicitly forcing the user to write special characters or caps. For example, querying in a varchar column for jose should retrieve JOSE, Jose, jos or jse I'm not sure how to achieve this. I'm using Hibernate as my JPA provider. Do I need Hibernate search? Regards,

20. HQL Queries with unicode characters    forum.hibernate.org