1. Using a CASE statement in HQL select stackoverflow.comIs there any way to do the following in HQL:
|
2. Pass a parameter to select case with group by in HQL stackoverflow.comI have the following HQL(The Hibernate Query Language) query (which is executed on oracle db connection) to retrieve an aggregated sum, based on month
|
3. How to do a like case-insensitive and accent insensitive in Oracle 10gR2 and JPA? stackoverflow.comIn a J2EE project, using JPA, how can I force a like query to be case insensitive and accent insensitive? I know about changing session variables NLS_COMP and NLS_SORT but I'm wondering ... |
4. hibernate jpa criteriabuilder ignore case queries stackoverflow.comHow to do a like ignore case query using criteria builder. For description property I want to do something like
|
5. Case-insensitive Query stackoverflow.comI have some ticket numbers that may have numbers and letters mixed. I'll be passing in the |
6. JPA CriteriaBuilder case query stackoverflow.comCan anyone provide an example of how to write a case query using |
7. On the surface, JPA Criteria Queries are a huge step back from Hibernate Criteria Queries. Is this really the case? stackoverflow.comHow could such a colossal step back be justified!?! Am I missing something? The readability of the entity manager version is just awful. session().createCriteria(Entity.class).add(Restrictions.eq("id"), id).uniqueResult(); versus
|
8. ORDER BY "CASE column" in JPA stackoverflow.comI want to ORDER BY the case statement, is it possible? How can I do it?
|
9. HQL, LIKE and case sensitive stackoverflow.comI wrote a project for hibernate+mysql. Now I'm porting it to Derby (for a number of reasons). Now I discovered that Derby is case sensitive when using LIKE in queries. This ... |
10. Case-insensitive ordering using Hibernate Criteria stackoverflow.comI have a query created with Hibernate Criteria like this:
I would like the ordering to be case-insensitive, equivalent to the HQL query
|
11. Case Insensitive Hibernate Queries coderanch.com |
12. Hibernate/Criteria Query/ Oracle case-when coderanch.com |
13. How to design a Hibernate Query for this case? forum.hibernate.orgIn a MySQL DB / Table livedata_tbl has two columns: Device_Id (numeric) & Stored_At (Timestamp). Which represents Device POJO Class, which has deviceId as Integer and storedAt as Timestamp. Records are stored into this database very frequently, and each Device_Id can repeat multiple times in this table. But the requirement is, How to select each unique device_id with latest timestamp. This ... |
14. Subquery inside CASE statement in select clause forum.hibernate.org |
15. case statement in select forum.hibernate.orgSelect uniqueId, case when ? = 1 then varchar_column else null end as sort_varchar, case when ? = 2 then int_column else null end as ... |
16. HQL: Usage of "case-when-then-else-end" with a where clause? forum.hibernate.orgI'm trying to use this with a where clause, but I can't just seem to get the hang of it. I also can't find many good examples online. I understand that there are two different versions, but I'm not sure which one suits my problem the best. What I'm trying to achieve to make a where clause dependent on the value ... |
17. case insensitive and accent insensitive query forum.hibernate.org |
18. case-insesitive select/order by forum.hibernate.orgI'm using hibernate 3.2 with oracle 10g. I'm trying to get the case-insensitive "select/order by" to work by changing NLS_SORT and NSL_COMP at session level within the DB (the default session setting). However, after the change my query result is still case-sensitive when sorted. It suggests that something (not me) is changing the NLS_ setting on the sessions. I'm using c3p0 ... |
19. Sorting case unsensitive forum.hibernate.orgLooking through Hibernate log the query seems the same. But I don't think that the problem is that. The query is really simple and the problem is the sorting criteria. The only thing that change is that the same code is executed in a windows machine and in a linux one. I tried to do the same query also with a ... |
20. Query cache with misses in case of entity parameter forum.hibernate.org |
21. Using CASE statement in order-by (Worked in Hibernate 3.3) forum.hibernate.orgAll, The following order-by in the mapping file worked with Hibernate 3.3 but is not working with the latest version? order-by="(case when TO_DATE is null then 0 else 1 end), TO_DATE desc, FROM_DATE desc, CREATED_DATE desc, ID desc" The error being reported is unexpected token: ( Code: 2011-06-15 14:15:14,962 DEBUG [main] (collection.AbstractCollectionPersister:611) - Static SQL for collection: com.jsi.fullcourt.domain.entity.Entity.names 2011-06-15 14:15:14,962 DEBUG ... |
22. order by and case insensitive forum.hibernate.org[quote="david"][quote="pearljam118"]Hi, By any chance we can sort the list in case insensitive without using HQL? Its just that we are using the paging functionality (setFirstResult+setmaxResults) as well. So, sorting at the java end is not possible. Thanks.[/quote] The ordering clause as shown by Mike will order in the database. The HQL is being translated to SQL and executed at the database. ... |
23. CASE WHEN select statement forum.hibernate.orgHi, This is a general question. In Postgres you can specify CASE... WHEN.. ELSE.. END in your select statement. For example, SELECT CASE WHEN id < 30 THEN 'NEW' else ' ' END would return NEW for all records with id less than 30, otherwise blank. Is this functionality supported in HQL? Is it written the same way? Thanks. |
24. why CASE clause in SELECT in Firebird? forum.hibernate.orghi there, spring 1.0.1 hibernate 2.1.2 firebird1.0 hibernate.dialect = net.sf.hibernate.dialect.FirebirdDialect why does hibernate generate a CASE clause in SELECT when using FirebirdDialect like this (an excerpt): select col1, case when ... then 0 when ... then 1 when ... then 2 end as clazz_, ... from MyTable ac0_ .... Firebird 1.0 does not understand CASE. This is log: 2004-06-03 15:35:36,382 DEBUG ... |
25. Criteria with case sensitive order forum.hibernate.org |
26. Case insensitivity in queries forum.hibernate.orgHibernate version: 2.1.4 I'm looking for some help on the following issue. SQLServer performs all string comparisons in a case insensitive fashion. So, to preserve this behavior on oracle, we have to make our queries such that they all code in case insensitivity. Using the hibernate API is to do this is not entirely possible from what i've seen. It is ... |
27. Case-Insensitive Criteria Order By forum.hibernate.orgI'm using Postgres 8 and Criteria queries. I am trying to order by a column, but Postgres sorts it so that upper case matches are plaaced before lower-cased ones. When doing a regular sql query, handling this is easy, as all you do is 'order by upper(x.y) asc'. I don't know how to do it using criteria queries, though. Is there ... |
28. query: case insensitive for mySQL ? forum.hibernate.orgHibernate version: 2.1.6 Name and version of the database you are using: MySQL 4.0.18 Hi, I would like to confirm if it is true that for my particular configuration the query is case insensitive - though what I have read so far seems that query should be case sensitive. I am using Spring framework together with Hibernate, here is the code: ... |
29. Fail to use select new MyClass(...) from .... in some cases forum.hibernate.orgHibernate version:3.0 When I use the following query: select myObj.name, count(*), Min(myObj.data), Max(myObj.date) from MyObjectClass myObj .... I get an array of Object, everything is fine. I can even check that I get an array of object and the first onject is of type String, the second of type Integer and the last 2 of type Timestamp. The following query is ... |
30. select case when then else end problem forum.hibernate.org |
31. How to order one-to-many collection case-insensitively? forum.hibernate.orgNewbie Joined: Tue May 24, 2005 10:40 pm Posts: 8 Location: Sydney, Australia Hi all, I've searched the forums, read the FAQs, and even tried debugging Hibernate in my IDE, but no joy. I'm trying to sort the elements of a one-to-many set by one of their string properties, case-insensitively. The generated SQL works fine in Hypersonic (as proven by my ... |
32. How to use SQL case in Projections.sum()? forum.hibernate.org |
33. Case insensitive sorting with Criteria API forum.hibernate.orgI am using Criteria API in Hibernate 3 and need to perform case insensitive sort, I know how to do it with HQL but the requirement is to use Criteria API. something like: criteria.addOrder(Order.asc("propertyName") will translate into SQL: order by column_name asc what we need to achieve is SQL: order by lower(column_name) asc Hibernate's Order class will not understand something like ... |
34. QBC Order By case-insensitive? forum.hibernate.orgIs there a way to use Query By Criteria to order the results without regard to case? I want to return the results ordered but I'm getting upper case sorted before lower. I used the Criteria.addOrder( Order.asc( "field" ) ) method. With SQL I would use a lower( "field" ) statement to get the results I want. The only resolution I ... |
35. CASE WHEN in select clause and *= in Where clause forum.hibernate.orgHi, I need to sort a result set on a computed column. The computed column use to be coded like this: case when myTable.orgId = 1 then myTable.orgName when myTable.orgId <> 1 and UPPER(Form.formLanguage) = 'F' then Organization.nameFrench when myTable.orgId <> 1 and UPPER(Form.formLanguage) = 'E' then Organization.nameEnglish end as organizationName I upgraded from Hibernate 2.1.4 to 3.0.5 because I read ... |
36. Query in "Select Case when end " stmt forum.hibernate.orgHibernate version: 3.1 "Select case when then else end " statement works fine unless I add another query in the else clause. Like below: select p.category, CASE WHEN p.icrossingTaxonomy.icCategoryId is not null THEN 0 else (select count(*) from Products p1 where p.category = p1.category and p1.icrossingTaxonomy.icCategoryId is null ) end as number from Products p where p.clients.feedId = 5 group by ... |
37. Order class ignore case method?? forum.hibernate.orgIf your posting (or a question you are referring to) was not answered by anybody, the possible reasons are: - http://www.hibernate.org/ForumMailingli ... AskForHelp - You did not submit enough information - Nobody knows the answer or has the free time to answer What you can do now: - Do the things listed in After Posting - Add missing and/or more information ... |
38. null in select case forum.hibernate.org |
39. HQL query with case-insensitive 'where' statement? forum.hibernate.org |
40. HQL case when then In select not parsing forum.hibernate.org |
41. Case insensitive queries forum.hibernate.org |
42. Select inside case statment forum.hibernate.orgHi I am using Hibernate 3.2 . I am having issues with HQL which has case statementsin my where clause. Inside the case I do have a select statement and it seem it is not supported. Here is HQL select new com.assurant.inc.sas.reminder.dto.ReminderDTO (reminder.rmndrId, reminder.caseDetails.caseDetailsId, reminder.caseDetails.solarId, reminder.emailSalesAlertFlg, reminder.emailNbcAlertFlg, reminder.rmndrNoteTxt, reminder.rmndrEffDt, reminder.rmndrFollowUpDt, ltrim(rtrim(companyGroup.name)), ltrim(rtrim(broker.firmName)), ltrim(rtrim(broker.lastName)), ltrim(rtrim(broker.firstName)), reminder.sasUserByCrtdUserId.userNm, reminder.sasUserByCrtdUserId.displayNm, case when reminder.emailSentDt is null ... |
43. how to handle a named query with CASE and UNION forum.hibernate.orgHi all, using the latest version of Hibernate, I am not sure how to handle this query: select TaskResources.PlanStartDate, TaskResources.PlanEndDate, TaskResources.PlanHours, TaskResources.Resource as Role, TaskResources.PlanResource as Person, case when Tasks.TaskName like 'Budget%' then Projects.Title else Tasks.TaskName end Task, case when Tasks.TaskName like 'Budget%' then Projects.Status else Tasks.Status end Status, Projects.ProjectNumber, Projects.Title, Projects.Release, Projects.Company, Tasks.Assigned as 'Assigned Now', Tasks.DocumentIdentifier FROM Projects, Tasks, ... |
44. HQL : Update with a case in the set clause forum.hibernate.orgjava.lang.ClassCastException: org.hibernate.hql.ast.tree.ParameterNode at org.hibernate.hql.ast.tree.CaseNode.getFirstThenNode(CaseNode.java:21) at org.hibernate.hql.ast.tree.CaseNode.getDataType(CaseNode.java:17) at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.extractDataType(BinaryLogicOperatorNode.java:168) at org.hibernate.hql.ast.tree.BinaryLogicOperatorNode.initialize(BinaryLogicOperatorNode.java:35) at org.hibernate.hql.ast.HqlSqlWalker.prepareLogicOperator(HqlSqlWalker.java:1007) at org.hibernate.hql.ast.HqlSqlWalker.evaluateAssignment(HqlSqlWalker.java:917) at org.hibernate.hql.antlr.HqlSqlBaseWalker.assignment(HqlSqlBaseWalker.java:1024) at org.hibernate.hql.antlr.HqlSqlBaseWalker.setClause(HqlSqlBaseWalker.java:729) at org.hibernate.hql.antlr.HqlSqlBaseWalker.updateStatement(HqlSqlBaseWalker.java:349) at org.hibernate.hql.antlr.HqlSqlBaseWalker.statement(HqlSqlBaseWalker.java:237) at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:228) at ... |
45. Exception in select case .. when .. then .. else .. end forum.hibernate.orgHi, I'm getting an error while trying the select case .. when .. then .. else .. end. ERROR : org.springframework.web.util.NestedServletException: Request processing failed; nested exception is java.lang.IllegalStateException: Unexpected AST: org.hibernate.hql.ast.SqlNode +-[CASE] SqlNode: 'case' | +-[WHEN] SqlNode: 'when' | | +-[EQ] SqlNode: '=' | | | +-[DOT] DotNode: 'home2_.BUILDERID' {propertyName=id,dereferenceType=4,propertyPath=builder.id,path=item.claim.home.builder.id,tableAlias=home2_,className=com.firstMonkey.beans.Home,classAlias=null} | | | | +-[DOT] DotNode: 'home2_.BUILDERID' {propertyName=id,dereferenceType=ROOT_LEVEL,propertyPath=builder.id,path=item.claim.home.builder,tableAlias=home2_,className=com.firstMonkey.beans.Home,classAlias=null} | | | ... |
46. CASE statement not supported in SQL count function? forum.hibernate.org |
47. Need help with resolving n+1 query problem for simple case forum.hibernate.orgI have a very simple case of two entities: UserIdentity and Student. Each UserIdentity related to exactly one Student. I have created a OneToOne association between UserIdentity and Student. When I load the UserIdentity table, I want Hibernate to eagerly load all the corresponding Student as well. This is working fine - however, I see in the log that it is ... |
48. How to do SELECT CASE in HQL (createQuery) forum.hibernate.org |
49. using select case statement independently in hql queries forum.hibernate.orgHi all, I have a web application thats output is dependent on sql queries. currently the application is tightly bound with oracle database. We are required to make the appl. db independent, so we are opted hibernate, because it gives a user to write hqls. Currently the existing application is using the select case ... then ... end stmts. So my ... |