union « HQL « JPA Q&A





2. how to use UNION function in HQL?    coderanch.com

3. When i use UNION ALL in HQL ASTQUERYTRANSLATOR shows error    forum.hibernate.org

Exception: org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found 'UNION' near line 1, column 442 This is the Query which am writing in DAO file StringBuffer subQuery = new StringBuffer(); subQuery.append(" Expense.lineNumber in ("); subQuery.append(" (SELECT ExpensePaymentAlloc.charge.lineNumber " ); subQuery.append(" FROM ExpensePaymentAllocVO as ExpensePaymentAlloc "); subQuery.append(" WHERE ExpensePaymentAlloc.payment.payable.payableId = "); subQuery.append( fieldValue ); subQuery.append(" ) union all ( Expense.lineNumber in ( SELECT PaymentReserve.expenseLineNumber " ); ...

4. union in hql    forum.hibernate.org

Is it possible to do a union in HQL? This would be very handy because I am trying to have all entries in a table where field1 = x and field2 = y appear at the top of the result set. Of course I could just add one list to the other but then paging would be more difficult. Or is ...

5. HQL - how can i make a union of two querys?    forum.hibernate.org

yes. my mistake. the query is: (SELECT OBJ1.ID, OBJ1.DESCRIPTION FROM OBJECT1 OBJ1) UNION (SELECT OBJ2.ID, OBJ2.DESCRIPTION FROM OBJECT2 OBJ2) I don't think that is a very good design idea in my particular business model to implement this kind of inheritance. I think that I'll use traditional SQL to resolve this issue. Thanks anyway

6. Union in HQL - alternatives    forum.hibernate.org

I want to sum all incomes and outcomes (simplified problem). In ordinary SQL I would use UNION, but HQL doesn't support it. I fount the following alternatives: 1) using ordinary SQL query, 2) manually sum incomes and outcomes in java :-( 3) write super class of income and outcome class :-( Did I miss any alternative? Why HQL doesn't support union? ...

7. HQL : UNION / Conditonal statements    forum.hibernate.org

8. UNION wiht HQL    forum.hibernate.org

9. HQL UNION Support and Hibernate 3.2.0 CR2    forum.hibernate.org

org.hibernate.TransactionException: Unable to locate UserTransaction to check status at org.hibernate.transaction.JTATransactionFactory.isTransactionInProgress(JTATransactionFactory.java:86) at org.hibernate.jdbc.JDBCContext.isTransactionInProgress(JDBCContext.java:180) at org.hibernate.impl.SessionImpl.isTransactionInProgress(SessionImpl.java:371) at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:955) at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1555) at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283) at com.iba.framework.core.pojo.dao.DAOImpl.findByObject(DAOImpl.java:111) at com.iba.ehis.ca.ioc.pojo.dao.ChartRecordingDAOImpl.getChartInfo(ChartRecordingDAOImpl.java:293) at com.iba.ehis.ca.ioc.pojo.business.ChartRecordingFacade.getChartInfo(ChartRecordingFacade.java:108) at com.iba.ehis.ca.ioc.pojo.business.ChartRecordingFacade.getObservationDates(ChartRecordingFacade.java:37) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:288) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:181) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:148) at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:100) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.interceptor.PerformanceMonitorInterceptor.invokeUnderTrace(PerformanceMonitorInterceptor.java:60) at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke(AbstractTraceInterceptor.java:111) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) at org.springframework.aop.interceptor.SimpleTraceInterceptor.invokeUnderTrace(SimpleTraceInterceptor.java:59) at org.springframework.aop.interceptor.AbstractTraceInterceptor.invoke(AbstractTraceInterceptor.java:111) at org.springframework.aop.interceptor.DebugInterceptor.invoke(DebugInterceptor.java:61) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:170) ...





10. WorkAround for UNION in HQL ??    forum.hibernate.org