-1
String query ="From transaction JOIN outlet transaction.outlet_ref_id = outlet.outletid WHERE(transaction.added_date_time between'"+sdate+"' and '"+edate+"') and (outlet.merchant ="+merchantId+")";

This is the query I'm using to retrieve data from the data base. This is working when I'm using this query in Navicat and gives data. But I'm using this as a hibernate query it gives following error.

enter image description here

Toshan
  • 23
  • 2
  • 9

1 Answers1

1

you need to write query Link : from Company as comp inner join comp.employees as emp. Company as comp means entityName as referenceName.

From Transaction t JOIN Outlet o t.outlet_ref_id = o.outletid WHERE(t.added_date_time between'"+sdate+"' and '"+edate+"') and (o.merchant ="+merchantId+")

use Entity name on Transaction

for more refer :

http://www.concretepage.com/hibernate/hibernate-hql-associations-and-inner-join-left-outer-join-right-outer-join-cross-join-example

https://docs.jboss.org/hibernate/orm/3.3/reference/en/html/queryhql.html

http://levelup.lishman.com/hibernate/hql/joins.php

Anshul Sharma
  • 3,432
  • 1
  • 12
  • 17