我有一个SQL查询,其中包含一个在数据库中正确运行的函数。在我的应用程序中,我正在使用HQL和JPA实体类,此函数现在给我一个错误。我已经将其他sql查询转换为hql了,只是这个函数给了我一个问题。有人可以让我了解我需要做出哪些改变才能使这个HQL查询/功能有效吗?
错误
java.lang.IllegalStateException:没有节点的数据类型:org.hibernate.hql.internal.ast.tree.MethodNode - [METHOD_CALL] MethodNode:'(' + - [METHOD_NAME] IdentNode:'contact_info.f_user_details'{originalText = contact_info.f_user_details} - [EXPR_LIST] SqlNode:'exprList' + - [QUOTED_STRING] LiteralNode:''ContactInfo'' + - [QUOTED_STRING] LiteralNode:''UserDetails'' + - [DOT] DotNode:'contactinf1_.USER_ID'{propertyName = userId,dereferenceType = ALL,propertyPath = id.userId,path = c.id.userId,tableAlias = contactinf1_,className = database.tables.ContactInfo,classAlias = c } | + - [DOT] DotNode:'contactinf1_.USER_ID'{propertyName = userId,dereferenceType = 2,propertyPath = id.userId,path = c.id.userId,tableAlias = contactinf1_,className = database.tables.ContactInfo,classAlias = c } | - [IDENT] IdentNode:'userId'{originalText = userId} - [NUM_INT] LiteralNode:'0'
HQL
select p.firstName, p.lastName,
contact_info.f_user_details('CONTACT_INFO','CONTACT_INFO.UserDetails',c.id.userId, 0) as details"
from Personnel p,
ContactInfo c, UserDetails ud
where p.userId = c.id.userId
and ud.userId = p.userId;
SQL
Select p.FIRST_NM, p.LAST_NAME,
contact_info.F_USER_DETAILS('CONTACT_INFO','CONTACT_INFO.USER_DETAILS',ud.USER_ID,0) as USER_DETAILS
from PERSONNEL p
inner Join CONTACT_INFO c
On p.USER_ID = c.USER_ID
inner join USER_DETAILS ud
on ud.USER_ID = p.USER_ID