I created entity classes Adress, Roadand County. A Roadis in Countyand a Adressin on a Road. I would like to list everything Adressesin County. Therefore, in my AdressServiceI say:
public List<Adress> AllAdresses(County county) {
Adress adress = new Adress();
Road road = new Road();
road.setCounty(county);
adress.setRoad(road);
Example example = Example.create(adress);
return (List<Adress>) adressDAO.query(Adress.class, example);
}
In mine AdressDAO, I have query ():
public List query(Class<?> c, Example example) {
return getSession().createCriteria(c).add(example).setMaxResults(100).list();
}
Executes the following query on my database server:
select this_.AdressId as AdressId2_0_,
this_.Description as Descript3_2_0_,
this_.DescriptionShort as Descript4_2_0_,
this_.HouseLetter as HouseLetter2_0_,
this_.HouseNr as HouseNr2_0_,
this_.RoadId as RoadId2_0_
from tblAdress this_
where (this_.HouseNr=0)
limit 100
I expected him to at least include some information about my essence Countyand inner connection with tblRoad. tblRoadhas a primary key roadId, so I expected to this_.roadIdbe connected to tblRoad.roadId, and I expected to tblRoad.countyIdbe installed in the primary key County, that is countyId.
, ? , , . , , ?