Currently, I have the following...
DetachedCriteria criteria = DetachedCriteria.forClass(TpvTransContactMapping.class, "mapping"); criteria.createAlias("theTrans", "trans", Criteria.LEFT_JOIN); //Tpvtrans table criteria.createAlias("account", "account", Criteria.LEFT_JOIN); //Account table DetachedCriteria newCrit = criteria.createCriteria("parent", "contact"); //TpvContact table newCrit.createCriteria("lastCall", "lastCall"); //back to Tpvtrans table newCrit.createCriteria("rootTpvtrans", "root"); //back to Tpvtrans table
and I need to add something like this... criteria.add(Restrictions.sqlRestriction("{contact}.callSeqEndDt > current_time - INTERVAL '{account}.monthsOfAudio months'"));
BUT in the docs, it only has {alias} which represents the row for table TpvTransContactMapping(alias = mapping) in this case. I seem to only be able to do {contact}.callSeqEndDt by using this line...
newCrit.add(Restrictions.sqlRestriction("{alias}.callSeqEndDt > current_time - INTERVAL '???? months'"));
which correctly does contact2_.callSeqEndDt correctly in the sql, BUT now I can't get the account.monthsOfAudio. Is there a way to do the first one or to get the alias's to print in the sqlRestriction correct?
NOTICE, to use the {alias}, I had to switch to newCrit so the target table was based on the parent(alias=contact) above.
thanks, Dean
_________________ The list of compelling reasons to reduce the estimate does not include you simply wishing it would take less time - Unknown
|