Hibernate version: 3.1.2.ga
Hello,
I've got a legacy database with a central "Client" table that has 2 exclusive FKeys to "Relex" and "NonRef".
I'd like to search in both tables for similar criterias.
I've build a DetachedCriteria that works on both tables. I now want to merge the results. As union is not supported, I'd like to use an "in" construct :
Code:
DetachedCriteria criteria = DetachedCriteria.forClass( Client.class, "client" );
clientNonRef.setProjection( Projections.property( "id" ) );
clientRelex.setProjection( Projections.property( "id" ) );
criteria.add( Expression.or( Subqueries.propertyIn( "id", clientNonRef ),
Subqueries.propertyIn( "id", clientRelex ) ) );
This doesn't work : everythink looks OK but the executed SQL doesn't declare the required joins used in each subquery.
Is this a known limitation ? Is there a workaround ?