Using jdbc driver retrieve records

37 views
Skip to first unread message

jaya raj

unread,
Sep 9, 2016, 5:46:21 AM9/9/16
to OrientDB
Hi ,

   I new to using orientdb jdbc driver, try to retrieve records using sql query but edge of  @rid field return whole object of the records,

   This is my java statement:

     ResultSet rs = stmt.executeQuery("select in('employee_has_store_service') as employee_id  from (traverse out('service_has_pricing') from (traverse   out('service_group_has_store_service') from (select from (select expand(out('store_has_service_group')['is_deleted = false']) from "+storeId+") order by created_date desc) while is_deleted = false ) while is_deleted = false) skip 0 limit -1");

Output:

employee_id : [store_service_person#295:747{out_employee_has_store_service:[size=5],out_employee_has_employee_working_hours:[size=1],person_name:jayaraj,last_name:,email_id:,login_access:false,enable_appointment:true,service_level:#349:0,is_deleted:false,created_date:Tue Aug 09 11:37:00 IST 2016,in_appointment_services_has_employee:[size=6],in_billing_services_has_employee:[size=4],mobile_no:,in_store_has_service_person:[size=1],in_billing_products_has_employee:[size=1]} v3, store_service_person#295:758{out_employee_has_store_service:[size=5],out_employee_has_employee_working_hours:[size=1],person_name:Ramachandran,last_name:,email_id:,login_access:false,enable_appointment:true,service_level:#349:0,is_deleted:false,created_date:Tue Aug 09 14:24:39 IST 2016,in_appointment_services_has_employee:[size=10],in_billing_services_has_employee:[size=5],mobile_no:,in_store_has_service_person:[size=1]} v3]


I am expecting output:

employee_id : ["#295:747","#295:758"]


Regards
Jayaraj






alessand...@gmail.com

unread,
Sep 9, 2016, 6:19:08 AM9/9/16
to OrientDB
Hi,
could you try with 

ResultSet rs = stmt.executeQuery("select in('employee_has_store_service').@rid as employee_id  from (traverse out('service_has_pricing') from (traverse   out('service_group_has_store_service') from (select from (select expand(out('store_has_service_group')['is_deleted = false']) from "+storeId+") order by created_date desc) while is_deleted = false ) while is_deleted = false) skip 0 limit -1");

Hope it helps.

alessand...@gmail.com

unread,
Sep 9, 2016, 7:01:50 AM9/9/16
to orient-...@googlegroups.com
Hi,
I have tried with this simple example

I have executed the query from Studio




and I executed this code with jdbc and it worked for me



Best regards,

Alessandro



jaya raj

unread,
Sep 9, 2016, 9:29:55 AM9/9/16
to OrientDB
Hi,

 Thanks for quick response,

  But you are using getstring method, i am using getObject method it is not worked for me.

  I am trying to convert resultSet object to json Object for to send response to web application.


Thanks,
Jayaraj
Reply all
Reply to author
Forward
0 new messages