日期:2014-05-18  浏览次数:20776 次

急急急!!大家可不可以帮一下,快来不及了。。hibernate 自己写SQL 文

Query   query         =session.createSQLQuery(strSQL);
int   _totalRows           =   query.list().size();


出现这个错   No   Dialect   mapping   for   JDBC   type:   3

sql文:

SELECT   PARENT_ID   AS   parentId,
              CHILD_ID   AS   childId,
              TITLE,
              USER_ID   AS   userId,
              CONVERT(varchar,   REG_DATE,   120)   AS   regDate,
              BEST_FLG   AS   bestFlg,
              CLOSE_FLG   AS   closeFlg,
              POINT,
              LAST_USER_ID   AS   lastUserId,
              CONVERT(varchar,   LAST_REP_DATE,   120)   AS   lastRepDate,
              CNT_REPLY   AS   cntReply,
              0   AS   top1,
              AREA_FLG   AS   areaFlg,
              ISNULL(LAST_REP_DATE,   REG_DATE)   AS   newTime,
              ROUND(CONVERT(decimal,   GETDATE()   -   REG_DATE)   *   1440,   0)   AS   passMin
    FROM   TBL_CHALLENGE
  WHERE   (CHILD_ID   =   '0 ')
      AND   (BEST_FLG   <>   '9 ')
  ORDER   BY   newTime   DESC

------解决方案--------------------
你在配置文件里面的Dialect没有指定或者该Dialect不能映射某个类型
可以尝试自己继承SQLHibernateDialect这样的类来映射自己定义的对象