Hibernate version:2.1.4
Mapping documents:
Code between sessionFactory.openSession() and session.close():
Full stack trace of any exception that occurs:
Name and version of the database you are using:Oracle9i
Debug level Hibernate log excerpt:
Hi,
If I create an alias on a criteria based on a bean (Bs) have a one-to-one association with another (Mx), there is not outer join generated in query
Code:
/**
*
* @hibernate.class table="BS"
*
* @author eboudrant
*/
public class Bs implements Serializable {
private Mx mx;
...
/**
* @hibernate.one-to-one
* class="com.bnpparibas.eqd.msl.eai.monitoring.Mx"
*/
public Mx getMx() {
return mx;
}
public void setMx(Mx mx) {
this.mx = mx;
}
...
}
Code:
...
Criteria criteria = session.createCriteria(Bs.class);
criteria.createAlias("mx", "Mx");
criteria.add(
Expression.or(
Expression.in("status", bsStatuses.toArray()),
Expression.in("mx.status", mxStatuses.toArray())
)
);
...
criteria.find();
Here the join SQL generated :
[code]
... this.ID=mx.MXID ...
[code]
If I remove the createAlias, the outer join is here. I have this SQL join :
[code]
... this.ID=[??].MXID (+) ...
[code]
(Alias is computed by hibernate like that : mx2_) so I was unable to do Expression.in("mx.status", mxStatuses.toArray()).
Is this a bug or am I missing somethig ?
Thx,
-emmanuel