Hi
Hi
I am writing a QBC query with a couple of joins in it and have a question...
I have a FleetDefect object, which contains a FleetVehicle, which contains a FleetVehicleSite...
So I start off with this criteria...
Criteria criteria = session.createCriteria(FleetDefect.class);
The FleetVehicle entity has a creationDate and I want to compare that
with the startDate of the fleetVehicleSite.
I can create my sub criteria for the joining tables, but how do I refer to the parent object FleetVehicle? from down in the subCriteria?
I need to access fleetVehicle.creationDate field...
So to clarify: FleetVehicleDefect -> FleetVehicle -> FleetVehiclesSite
startDate and endDate are in the FleetVehiclesSite entity and
creationDate is in FleetDefect:
Criteria criteria = session.createCriteria(FleetDefect.class);
criteria.createCriteria("fleetVehicle")
.createCriteria("fleetVehiclesSite")
.add(Expression.and(
Expression.le("startDate",
"this.creationDate"),
Expression.ge("endDate",
"this.creationDate")
));
I know I can this working using QBE, but like the riteria stuff so would like to use that if possible...
Any help would be appreciated on this (and I have read my Hibernate in Action chapter on QBC/E! :))
Hibernate version:2.1.7
Mapping documents:
Name and version of the database you are using:Oracle 9i
The generated SQL (show_sql=true):
Debug level Hibernate log excerpt:
|