0
session.createQuery(" from " +
"(select att.licenceNo license,driver.driverName drivername" +
" from DriverAttendanceDTO att,DriverDetailsDTO driver" +
" where att.licenceNo=driver.licenceNo" +
" and att.recordStatus='A'" +
" and driver.recordStatus='A')");
Hibernate是爲了給我如何在HQL中編寫內聯視圖?
Exception in thread "main" org.hibernate.hql.ast.QuerySyntaxException: unexpected token: (near line 1, column 7 [ from (select att.licenceNo license,driver.driverName drivername,att.present present from com.vms.dto.DriverAttendanceDTO att,com.vms.dto.DriverDetailsDTO driver where att.licenceNo=driver.licenceNo and att.recordStatus='A' and driver.recordStatus='A')]
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:54)
at org.hibernate.hql.ast.QuerySyntaxException.convert(QuerySyntaxException.java:47)
有什麼不好呢?
我的意見是,你是在浪費與HQL你的時間。只需編寫一個正常的SQL查詢。 – david
@david以上建議不適用。 –
@Kishan你的目標是什麼?在查詢開始時''from'是什麼意思? –