我有此錯誤:JPA/Hibernate意外的AST節點。指定列名dimanically
10:54:38,330 ERROR SessionFactoryImpl:363 - Error in named query: transactions.auto org.hibernate.hql.ast.QuerySyntaxException: unexpected AST node: : near line 1, column 8 [select :fields from com.TransactionsEntity t where t.transactionDate >= :startDate and t.transactionDate <= :endDate order by id]
意想不到的AST節點:
選擇:從 com.TransactionsEntity科技領域
清潔命名查詢:
select :fields from com.TransactionsEntity t where t.transactionDate >= :startDate and t.transactionDate <= :endDate order by id
有是否可以使用參數添加我需要選擇的列的任何方式?我發現我不能在聲明的選擇部分使用「:」。
感謝
是有一種方法。請在這裏發佈您的查詢。 –
還指定您想要檢索的字段名稱。並告訴你是否需要多個結果或單個結果? –
多,如果有,但我需要從以前的加載字符串像這樣指定名稱:「t.field1,t.field2」 ... – Genaut