How to access JSON property in Oracle 12c JSON column using Hibernate HQL?

Oracle 12c introduced support for the JSON data type ( https://docs.oracle.com/database/121/ADXDB/json.htm#ADXDB6371 ). In this case, the following request types will be executed:

SELECT po.po_document.PONumber FROM j_purchaseorder po;

where PONumberis the key of the JSON string.

I want to know how I can use the above query type in hibernate hql. My experiments throw an exception (sleep mode 4.3.10. Initial version)

My code

      Query query = session.createQuery("from Teacher 
           t where t.address.City = 'exp' ");
      List list = sqlQuery.list();

I get an error org.hibernate.QueryException: could not resolve property City of: Teacher

How to resolve this?

+4
source share

All Articles