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

687 views Asked by At

Oracle 12c has introduced support for JSON datatype ( https://docs.oracle.com/database/121/ADXDB/json.htm#ADXDB6371 ). Under this following type of queries will be valid,

SELECT po.po_document.PONumber FROM j_purchaseorder po;

where PONumber is a key of JSON string.

I want to know how can i use above type of queries in hibernate hql. My experiments throws exception ( hibernate 4.3.10.Final version )

My Code

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

I'm getting error org.hibernate.QueryException: could not resolve property City of: Teacher

How to resolve this ?

0

There are 0 answers