In my android app I am accessing external PostgreSQL database, I am able to get json data but here I am accessing three tables which are related through there id's.I am getting those tables json data individually. Now my question is how to get data from three tables that I want through there relation in my app?In my app I am using Spring Rest API.
With this link I am accessing first table,
http://localhost:443/seis/productTemplateController/getproductTemplate
and I am getting json data like this.
[{"name":"Mobile","id":31,"state":null,"type":"consu","description":null,"active":true,"create_uid":1,"create_date":1466549730430,"write_date":1466549730430,"write_uid":1,"warranty":0.0,"uos_id":null,"list_price":12000.00,"color":null,"image":null,"mes_type":"fixed","uom_id":1,"uos_coeff":1.000,"sale_ok":false,"categ_id":1,"company_id":1,"uom_po_id":1,"weight":0.00,"weight_net":0.00,"volume":0.0,"rental":false,"image_medium":null,"image_small":null,"track_all":false,"loc_rack":null,"loc_case":null,"loc_row":null,"sale_delay":7.0,"purchase_ok":true,"project_id":null,"avail_scheme":null,"product_id":"M001","product_cat":null,"message_last_post":null,"description_purchase":null,"product_manager":null,"description_sale":null,"track_outgoing":false,"track_incoming":false,"auto_create_task":false,"product_brande":null,"product_serial":null,"product_sub_subcategory":null,"product_subcategory":null,"product_modele":null}]
With this link I am accessing second table,
http://localhost:443/seis/productAccount/getAccount
and I am getting json data like this.
[{"name":null,"id":32,"state":"paid","type":"in_invoice","number":"EXJ/2016/0003","origin":null,"comment":null,"reference":null,"message_last_post":null,"commercial_partner_id":29,"fiscal_position":null,"amount_untaxed":0.00,"partner_bank_id":null,"supplier_invoice_number":"123","reference_type":"none","internal_number":"EXJ/2016/0003","installation_date":null,"create_uid":1,"create_date":1466557180185,"write_date":1466557192973,"write_uid":1,"company_id":1,"user_id":1,"section_id":null,"amount_tax":0.00,"date_due":"2016-06-22","check_total":0.00,"payment_term":null,"currency_id":21,"partner_id":29,"journal_id":2,"move_id":47,"account_id":37,"reconciled":true,"residual":0.00,"move_name":"/","date_invoice":"2016-06-22","period_id":7,"amount_total":0.00,"sent":false,"service3_date":null,"service2_date":null,"delivery_date":null,"service1_date":null}]
With this link I am accessing third table,
http://localhost:443/seis/resPartnerController/getPartner
and I am getting json data like this.
[{"name":"Varenya","id":39,"type":"contact","ref":null,"comment":null,"date":null,"message_last_post":null,"use_parent_address":false,"commercial_partner_id":39,"signup_expiration":null,"calendar_last_notif_ack":null,"last_reconciliation_date":null,"tax_identification_no":null,"ean13":null,"active":true,"create_uid":1,"create_date":1466548847830,"write_date":1466548847830,"write_uid":1,"color":0,"image":null,"company_id":1,"image_medium":null,"image_small":null,"street":null,"city":null,"display_name":"Varenya","zip":null,"title":null,"function":null,"country_id":null,"parent_id":null,"supplier":true,"email":null,"is_company":false,"website":null,"customer":false,"fax":null,"street2":null,"credit_limit":null,"employee":false,"tz":"Asia/Kolkata","lang":"en_US","phone":null,"mobile":null,"user_id":null,"birthdate":null,"vat":null,"state_id":null,"notify_email":"always","opt_out":false,"section_id":null,"signup_type":null,"signup_token":null,"debit_limit":null,"vat_subjected":false,"exercise_no":null,"swift":null,"msme_no":null,"micr":null,"service_tax":null,"cst":null},{"name":"swathi","id":31,"type":"contact","ref":null,"comment":"Customer of varenya","date":"2016-06-21","message_last_post":null,"use_parent_address":false,"commercial_partner_id":30,"signup_expiration":null,"calendar_last_notif_ack":null,"last_reconciliation_date":1466479345000,"tax_identification_no":null,"ean13":null,"active":true,"create_uid":1,"create_date":1466055326322,"write_date":1466479344558,"write_uid":1,"color":0,"image":null,"company_id":1,"image_medium":null,"image_small":null,"street":null,"city":null,"display_name":"Hcl, swathi","zip":null,"title":null,"function":null,"country_id":null,"parent_id":30,"supplier":false,"email":null,"is_company":false,"website":null,"customer":true,"fax":null,"street2":null,"credit_limit":0.0,"employee":false,"tz":"Asia/Kolkata","lang":"en_US","phone":null,"mobile":null,"user_id":null,"birthdate":null,"vat":null,"state_id":null,"notify_email":"always","opt_out":false,"section_id":null,"signup_type":null,"signup_token":null,"debit_limit":0.0,"vat_subjected":false,"exercise_no":null,"swift":null,"msme_no":null,"micr":null,"service_tax":null,"cst":null}]
Well first I would suggest you use Gson to parse the Json into ProductTemplate, Account, Partner classes. Then you would have id-fields to establish the connection between them?