Hello all, sorry, I'm new at hibernate I have composed a simple web service with 2 tables, relationed 'manytoone' (countries and regions) When I call the web service I want to return the list of countries and the name of the region for each country
I can see the query that hibernate composes, and it's correct: select country0_.id_co as id1_0_0_, region1_.id_reg as id1_3_1_, country0_.area as area0_0_, country0_.code as code0_0_, country0_.name as name0_0_, country0_.population as population0_0_, country0_.id_reg as id6_0_0_, region1_.name as name3_1_ from sevc_schema.country country0_ left outer join sevc_schema.region region1_ on country0_.id_reg=region1_.id_reg
but in the out: return hibernateTemplate.find("from Country as co left join fetch co.region");
the json only returns the countries's fields, but not the region relationed with them. Something like: {"data":[{"name":"Andorra","id":133,"code":"AN","area":0,"pop":73483},{"name":"Afghanistan","id":31,"code":"AF","area":652090,"pop":25067407},{"name":"Sao Tome and Principe","id":199,"code":"TP","area":96,"pop":152622},{"name":"Bahamas","id":13,"code":"BF","area":1001,"pop":323295},{"name":"Bahrain","id":10,"code":"BA","area":71,"pop":724788},{"name":"Anguilla","id":128,"code":"AV","area":0,"pop":12256
Any help please???, thanks in advance
|