Hi everyone,
my problem is with a criteria queries.
This is my case:
DetachedCriteria dc =
DetachedCriteria.forClass(TransferenciaLote.class);
dc
.createCriteria("transferenciaLoteDetalle") //is a collection of Transferencia
.createAlias("cuentaDestino", "cuentaDestino")
.add(Restrictions.like("cuentaDestino.denominacion", "GONZALEZ CARLOS",MatchMode.ANYWHERE));
That works fine but, I would need to put it (my DetachedCriteria object) inside other criteria object, because I have other queries to execute too. I mind, I need to retrieve all elements inside collection, and then other cases, but all together over one criteria.
it would be something like this:
Criteria crit = session.createCriteria(TransferenciaLote.class);
crit.add(Restrictions.like("observaciones", "otros",MatchMode.ANYWHERE)); //other
crit.add(????("???", dc)); //here would be DetachedCriteria object
My classes:
TransferenciaLote.java
public class TransferenciaLote extends TFLObject implements IPersistant, IViewable {
private List transferenciaLoteDetalle;
private String observaciones;
Transferencia.java
public abstract class Transferencia implements IPersistant, IViewable, Serializable {
private CuentaBase cuentaDestino;
private TransferenciaLote transferenciaLote;
can everyone help me ¿?
Best regards
Julián
|