[SEAM] 命名查询错误,各位大牛来帮我看看
无双Rama
2009-06-26
我在实体中有一个命名查询如下:
@NamedQueries(value = { @NamedQuery(name = "BudgetAuthorization.getBudgetAuthorizationByNumberAnnal", query = "from BudgetAuthorization b where b.directorNumber =:directorNumber and b.annualPlanning.id=(select a.id from AnnualPlanning a where rownum<2 order by a.id desc)") }) 运行的时候它报这样的异常: select budgetauth0_.id as id2586_, budgetauth0_.createDate as createDate2586_, budgetauth0_.updateDate as updateDate2586_, budgetauth0_.creator_userId as creator12_2586_, budgetauth0_.lastUpdater_userId as lastUpd13_2586_, budgetauth0_.deptCode as deptCode2586_, budgetauth0_.deptLevel as deptLevel2586_, budgetauth0_.amount as amount2586_, budgetauth0_.directorNumber as director7_2586_, budgetauth0_.deptBudget as deptBudget2586_, budgetauth0_.sendBack as sendBack2586_, budgetauth0_.annualPlanning_id as annualP14_2586_, budgetauth0_.deptName as deptName2586_, budgetauth0_.directorName as directo11_2586_ from BudgetAuthorization budgetauth0_ where budgetauth0_.directorNumber=? and budgetauth0_.annualPlanning_id=( select annualplan1_.id from AnnualPlanning annualplan1_ where rownum<2 order by annualplan1_.id desc ) 16:34:39,778 WARN [JDBCExceptionReporter] SQL Error: 907, SQLState: 42000 16:34:39,778 ERROR [JDBCExceptionReporter] ORA-00907: 遺漏右括弧 嚴重的: Error Rendering View[/ess/authorizeAndModulateSalary.xhtml] javax.persistence.PersistenceException: org.hibernate.exception.SQLGrammarException: could not execute query 是哪里出错了呢? |
|
5day
2009-06-26
不懂
|
|
andyhan
2009-06-26
为啥要这么写?
from BudgetAuthorization b where b.directorNumber =:directorNumber order by b.annualPlanning.id desc 然后,setMaxResult(2) |
|
无双Rama
2009-06-27
终于知道了,ORA-00907: 遺漏右括弧 ,表示生成表的时候有异常。我们这个原因是表里面有一个属性是check,好像是oracle里面的关键字~~~~~郁闷啊
could not execute query :是因为没有实体可用来查询,是由上面造成的 |