List<Lahetys> last = session.createQuery("from lahetys order by lahetysNro DESC LIMIT 1").list();
そして私が得たログで:
INFO: Hibernate: select from order by lahetysNro DESC LIMIT 1
WARN: SQL Error: 1064, SQLState: 42000
ERROR: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'from order by lahetysNro DESC LIMIT 1' at line 1
「from LAHETYS」はどうなりましたか?HQLまたは/およびSQLでそれを処理するためのベストプラクティスは何ですか?
別の問題:
Lahetys last = (Lahetys)session.createSQLQuery("select * from lahetys order by lahetysNro DESC LIMIT 1").uniqueResult();
session.getTransaction().commit();
そして私は例外を受け取ります:
Ljava.lang.Object; cannot be cast to Lahetys
オブジェクトを自分の Lahetys オブジェクトにキャストすることはできません。
ありがとうございました!サーミ語