-->
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: JPA Queries Join
PostPosted: Mon Sep 23, 2013 5:36 am 
Newbie

Joined: Fri Jun 21, 2013 2:04 am
Posts: 4
Hi,

I am having a JPA Query:
<named-query name="AUDIT_QUERY">
<query>select rx.rxNumber, rx.rxFillStatus.id, tx.rx.rxaaId, tx.id, tx.drugUpc.id,
tx.compound.id, tx.tpSpecialServiceFee.id,tx.txHistoryDrugUpc.id,
tx.txHistoryCompound.id, tx.txHistoryTpSpecialServiceFee.id,
tx.txHistoryRx.id, tx.txNumber,tx.txStatus.id,tx.txAdjudicationStatus.id,
tx.serviceDate, tx.createDatetime, tx.txQuantity, tx.remainingQuantity, tx.daysSupply,
tx.ppTotal, tx.tpPaidTotal, tx.adjustedTotal, sig.sigDescriptionStoreLanguage ,
sig.sigDescriptionPatientLanguage , tx.serviceDate
from
Rx rx JOIN FETCH Tx tx JOIN TxSig sig WHERE rx.rxaaId = tx.rx.rxaaId
and tx.txSig.id = sig.id WHERE
rx.patient.id = ?
order by tx.serviceDate desc, tx.txNumber desc,
tx.id desc</query>
</named-query>

While parsing, hibernate throws error:


org.hibernate.hql.internal.ast.QuerySyntaxException: unexpected token: WHERE near line 1, column 620 [select rx.rxNumber, rx.rxFillStatus.id, tx.rx.rxaaId, tx.id, tx.drugUpc.id, tx.compound.id, tx.tpSpecialServiceFee.id,tx.txHistoryDrugUpc.id, tx.txHistoryCompound.id, tx.txHistoryTpSpecialServiceFee.id, tx.txHistoryRx.id, tx.txNumber,tx.txStatus.id,tx.txAdjudicationStatus.id, tx.serviceDate, tx.createDatetime, tx.txQuantity, tx.remainingQuantity, tx.daysSupply, tx.ppTotal, tx.tpPaidTotal, tx.adjustedTotal, sig.sigDescriptionStoreLanguage , sig.sigDescriptionPatientLanguage , tx.serviceDate from com.sdm.hw.rx.dao.entity.Rx rx JOIN FETCH Tx tx JOIN TxSig sig WHERE rx.rxaaId = tx.rx.rxaaId and tx.txSig.id = sig.id WHERE rx.patient.id = ? order by tx.serviceDate desc, tx.txNumber desc, tx.id desc]
Any help will be appreciated.

Thanks,
Giriraj


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.