-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: hibernate nd web service
PostPosted: Sat Feb 18, 2012 11:34 am 
Newbie

Joined: Sat Feb 18, 2012 11:31 am
Posts: 5
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


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.