Thanks Amila. I tried this solution and looks like it's not what I am after.
The following code essentially produced sql that 'and' two criteria together, while I really need 'or'.
I tried to use the 'LEFT_JOIN' when calling the criteria.createCriteria. It worked , but the performance just like a dog.
I think the question is to union two result set, that is : txns with stock legs involving USD and txns with fx legs involving USD.
regards
CFN
amila733 wrote:
Hi
List b = sess.createCriteria(TXN.class,"t")
.createCriteria("stockLegs","sl")
.createCriteria("t.fxLegs","fl")
.add(Restrictions.or(Restrictions.eq("sl.currency", "USD") ,Restrictions.eq("fl.currency", "USD"))).list();
this may similar to your database structure
Amila
(Don't forget to rate if helps)