openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mvas <>
Subject quick question regarding joining tables
Date Wed, 25 Aug 2010 20:37:42 GMT


I have the follwing problem and I was wondering if anyone know the answer or
can provide me with a tutorial link or any other helpful information....

I have the code below, the tables are standalone (don't ask me why... even
they don't know....) and I have to quesry them basen on the attribues in the
code (where start/end day is always the current) and display a list based on
the search criteria.....
My problem is that if for example I have two entries in the
"BrandOrderOffer" with the "OrderOffer" ordOffrN. 
(eg. {brand/ordOffrN} {1, 10} and {2,10} where the common ordOffrN=10) then
I'm getting back two full instances of the result.
I need to join the tables but I'm not sure on how to do it in openjpa (if
Could someone give his lights on this one please?

many thanks in advance...


results = em.createQuery(""+
				"select boo,oo,ooq,oori from"+
				" BrandOrderOffer boo, OrderOffer oo, OrderOfferOriginQualification ooq,
OrderOfferRewardItem oori "+
				" where"+
				" = :brand and"+
				" = and"+
				" = and"+
				" = oori.rwrdN and"+
				" = '9' and"+
				" oo.ordOffrCancF = 'N' and"+
				" > :endDate and"+
				" <= :startDate and"+				
				" (oo.ordOffrCustC = :custType or oo.ordOffrCustC = '3') and"+
				" (oo.ordTypeN is null or oo.ordTypeN='   ' or oo.ordTypeN=:orderType)")

View this message in context:
Sent from the OpenJPA Users mailing list archive at

View raw message