0
以下是我想要轉換爲HQL的SQL。有人可以幫助我嗎?我也張貼我的HQL這是目前給我一個空指針異常 -多重內部加入HQL
select ti.tax_id_no,
u1.user_id,
u1.user_nm_fst,
u1.user_nm_lst,
u1.user_ph_no,
u1.user_email
from pcmp.tax_identifier ti
inner join (select ucax.user_id, ucax.cust_id
from pcmp.users_customer_access_xref ucax
where ucax.ptcp_typ_cd = 'insrd'
and ucax.void_ind = 'n'
and ucax.user_cust_accs_xref_end_dt is null) ucax1
on ucax1.cust_id = ti.cust_id
inner join (select u.user_id,
u.user_nm_fst,
u.user_nm_lst,
u.user_ph_no,
u.user_email
from pcmp.users u
where u.user_end_dt is null
and u.user_void_ind = 'n') u1
on u1.user_id = ucax1.user_id
where ti.tax_id_no = '830204947'-- '465202523'
and ti.void_ind = 'n'
and ti.tax_id_end_dt is null
我嘗試使用下面的查詢,但遇到了錯誤 -
String queryString = "select u from User u"
+ " INNER JOIN u.ucax userCustomerAccessXref"
+ " INNER JOIN u.ti taxIdentifier"
+ " where taxIdentifier.tax_id_id = ?1";
的例外,我得到使用上述查詢 -
顯示java.lang.NullPointerException
org.hibernate.hql.ast.HqlSqlWalker.createFromJoinElement(HqlSqlWalker.java:383)
org.hibernate.hql.antlr.HqlSqlBaseWalker.joinElement(HqlSqlBaseWalker.java:3585)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElement(HqlSqlBaseWalker.java:3366)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromElementList(HqlSqlBaseWalker.java:3239)
org.hibernate.hql.antlr.HqlSqlBaseWalker.fromClause(HqlSqlBaseWalker.java:726)