我試圖從數據庫中使用下面的hibernate查詢錯誤:org.hibernate.hql.internal.ast.ErrorCounter - 行1:45:意外標記:從表中提取最後一條記錄的DESC
//fetch the last data from a field in a table
Session session = _sessionFactory.getCurrentSession();
Query query = session.createQuery("select t.currentfile from file t DESC");
query.setMaxResults(1);
List<Object[]> rows = query.list();
for (Object[] row: rows) {
System.out.println(" ------------------- ");
System.out.println("current file: " + row[0]);
}
與上面的HQL我收到此錯誤:
ERROR: org.hibernate.hql.internal.ast.ErrorCounter - line 1:45: unexpected token
: DESC
什麼地方出錯了?
這會給我當前文件列中的最新數據 – Francis
好吧,我有這個問題無法解決路徑t.currentfile。意外令牌t – Francis
不能轉換爲[Ljava.lang.Object; – Francis