我正在尝试使用休眠从我的数据库的多个表中返回数据。该查询在我的 SQL 服务器上运行良好,但它似乎在休眠状态下不起作用。
Query threadQuery = session.createSQLQuery("SELECT CONCAT(t.lastposter) as lastposter, t.lastpost, t.title, t.threadid, t.lastpostid, t.firstpostid, t.forumid, p.pagetext FROM vbulletin.thread AS t INNER JOIN vbulletin.post AS p ON p.postid = t.firstpostid WHERE t.open != 10 AND t.visible = 1 AND t.forumid != 19 AND t.forumid != 20 ORDER BY t.lastpost DESC").setResultTransformer(Transformers.aliasToBean(VbulletinThread.class));
例外
org.hibernate.MappingException: No Dialect mapping for JDBC type: -1
注意:当我从查询中删除 p.pagetext 时它工作正常。