Hibernate:unexpected end of subtree异常的解决方法

Exception in thread "AWT-EventQueue-0" org.springframework.orm.hibernate3.HibernateQueryException: unexpected end of subtree [FROM com.ge.healthcare.gehcit.ehrae.sv2.dto.SVTemplate WHERE id in ()]; nested exception is org.hibernate.hql.ast.QuerySyntaxError: unexpected end of subtree [FROM sv2.dto.SVTemplate WHERE id in ()]
org.hibernate.hql.ast.QuerySyntaxError: unexpected end of subtree [FROM sv2.dto.SVTemplate WHERE id in ()]
    at org.hibernate.hql.ast.ErrorCounter.throwQueryException(ErrorCounter.java:63)
    at org.hibernate.hql.ast.QueryTranslatorImpl.analyze(QueryTranslatorImpl.java:196)
    at org.hibernate.hql.ast.QueryTranslatorImpl.doCompile(QueryTranslatorImpl.java:130)
    at org.hibernate.hql.ast.QueryTranslatorImpl.compile(QueryTranslatorImpl.java:83)
    at org.hibernate.impl.SessionFactoryImpl.getQuery(SessionFactoryImpl.java:427)
    at org.hibernate.impl.SessionImpl.getQueries(SessionImpl.java:884)
    at org.hibernate.impl.SessionImpl.list(SessionImpl.java:834)
    at org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
    at org.springframework.orm.hibernate3.HibernateTemplate$30.doInHibernate(HibernateTemplate.java:852)
    at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:365)
    at org.springframework.orm.hibernate3.HibernateTemplate.findByNamedParam(HibernateTemplate.java:843)

 

经过调试,发现问题是在调用getHibernateTemplate().findByNamedParam(String query, String[] paramNames, Object[] values)时,传到values中的值为空,会出现该异常。

 

因此在调用时要进行Check一下。

你可能感兴趣的:(Java开发)