These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: AST Translator is not supporting UNION ALL in hibernate
PostPosted: Wed Nov 18, 2009 5:07 am 
Newbie

Joined: Tue Nov 03, 2009 6:52 am
Posts: 1
we are using UNION ALL in AST Translator in hibernate it is showing error
Code:
criteria[i].getValue(aliasType.get(fieldAlias).toString());
               paymentSubQuery.append(" Invoice.id in (( Select InvoiceExpense.invoiceId  ");
               paymentSubQuery.append("    from InvoiceExpenseVO as InvoiceExpense, " );
               paymentSubQuery.append("        ExpensePaymentAllocVO as ExpensePaymentAlloc ");
               paymentSubQuery.append("    where InvoiceExpense.lineNumber = ExpensePaymentAlloc.charge.lineNumber " );
               paymentSubQuery.append("    and   ExpensePaymentAlloc.payment.id   " + fieldValue  + ")");
               paymentSubQuery.append("    UNION ALL ( Select InvoiceFee.invoiceId" );
               paymentSubQuery.append("    from InvoiceFeeVO as InvoiceFee, " );
               paymentSubQuery.append("        FeePaymentAllocVO as FeePaymentAlloc ");
               paymentSubQuery.append("    where InvoiceFee.lineNumber = FeePaymentAlloc.charge.lineNumber " );
               paymentSubQuery.append("    and   FeePaymentAlloc.payment.id   " + fieldValue + ")");
               paymentSubQuery.append("    UNION ALL ( Select InvoiceExpense.invoiceId " );
               paymentSubQuery.append("    from InvoiceExpenseVO as InvoiceExpense, " );
               paymentSubQuery.append("        PaymentReserveVO as PaymentReserve ");
               paymentSubQuery.append("    where InvoiceExpense.lineNumber = PaymentReserve.expenseLineNumber " );
               paymentSubQuery.append("    and   PaymentReserve.paymentId   " + fieldValue + ")");
               paymentSubQuery.append("    UNION ALL  ( Select InvoiceTrading.outgoingInvoice.id  ");
              paymentSubQuery.append("    from InvoiceTradingVO as InvoiceTrading, " );
              paymentSubQuery.append("        TradingPaymentAllocVO as TradingPaymentAlloc ");
              paymentSubQuery.append("    where InvoiceTrading.charge.lineNumber = TradingPaymentAlloc.charge.lineNumber " );
              paymentSubQuery.append("    and   TradingPaymentAlloc.payment.id   " + fieldValue  + ")");
               paymentSubQuery.append(" )" );
               invoiceOuterWhereClause.add(paymentSubQuery.toString());



Error:
org.hibernate.hql.ast.QuerySyntaxException: expecting CLOSE, found 'UNION' near line 1, column 481 [Select Invoice from com.bofa.crme.dac.persistence.valueobject.InvoiceVO as Invoice where Invoice.id in (( Select InvoiceExpense.invoiceId from com.bofa.crme.dac.persistence.valueobject.InvoiceExpenseVO as InvoiceExpense, com.bofa.crme.dac.persistence.valueobject.ExpensePaymentAllocVO as ExpensePaymentAlloc where InvoiceExpense.lineNumber = ExpensePaymentAlloc.charge.lineNumber and ExpensePaymentAlloc.payment.id = 1538) UNION ALL ( Select InvoiceFee.invoiceId from com.bofa.crme.dac.persistence.valueobject.InvoiceFeeVO as InvoiceFee, com.bofa.crme.dac.persistence.valueobject.FeePaymentAllocVO as FeePaymentAlloc where InvoiceFee.lineNumber = FeePaymentAlloc.charge.lineNumber and FeePaymentAlloc.payment.id = 1538) UNION ALL ( Select InvoiceExpense.invoiceId from com.bofa.crme.dac.persistence.valueobject.InvoiceExpenseVO as InvoiceExpense, com.bofa.crme.dac.persistence.valueobject.PaymentReserveVO as PaymentReserve where InvoiceExpense.lineNumber = PaymentReserve.expenseLineNumber and PaymentReserve.paymentId = 1538) UNION ALL ( Select InvoiceTrading.outgoingInvoice.id from com.bofa.crme.dac.persistence.valueobject.InvoiceTradingVO as InvoiceTrading, com.bofa.crme.dac.persistence.valueobject.TradingPaymentAllocVO as TradingPaymentAlloc where InvoiceTrading.charge.lineNumber = TradingPaymentAlloc.charge.lineNumber and TradingPaymentAlloc.payment.id = 1538) )]

I think AST doesnot support UNION ALL in hibernate, so can any one tell me is there any alternate solution that we can use apart from UNION ALL.

Thanks in Advance!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.