wzy

          java

          常用鏈接

          統計

          最新評論

          No Dialect mapping for JDBC type: 3

           

          public class LabourCostStatImpl {

           

          public List getList(){

                 Session session = HibernateSessionFactory.getSession();

                 String sql="select c.mark, s.towerId, p.daysalary, c.workNum , c.planAttributeId  ,s.powerLevelId from person p,persondaycutplan c,PersonDayCutPlanEquipmentSdgq s  where  c.writerid=p.id and c.id=s.planId ";

                 Query query=session.createSQLQuery(sql);

                 @SuppressWarnings("unused")

                 List list =null;

                 if(query!=null){

                     list =query.list();

                 }

                 return list;

              }

             

              }

          }

           

           

          package test;

           

          import java.util.ArrayList;

          import java.util.HashSet;

          import java.util.Iterator;

          import java.util.List;

          import java.util.Set;

           

          import com.dartfar.sdxl.dao.impl.LabourCostStatImpl;

          import com.jxgl.data.dao.exception.DAOException;

           

          public class test4 {

           

              /**

               * @param args

               * @throws DAOException

               */

              @SuppressWarnings("unchecked")

              public static void main(String[] args) throws DAOException {

                 // TODO Auto-generated method stub

                 LabourCostStatImpl labour = new LabourCostStatImpl();

                 List list =labour.getList();

                 System.out.println(list.size());

                     }

              }

           

          *********rebuildSessionFactory**********

          [20080715 08:51:40,781] [DEBUG] com.jxgl.data.dao.impl.hibernate.PersonDAOHibernateImpl - 得到指定用戶名:null 的用戶

          Exception in thread "main" org.hibernate.MappingException: No Dialect mapping for JDBC type: 3

              at org.hibernate.dialect.TypeNames.get(TypeNames.java:56)

              at org.hibernate.dialect.TypeNames.get(TypeNames.java:81)

              at org.hibernate.dialect.Dialect.getHibernateTypeName(Dialect.java:192)

              at org.hibernate.loader.custom.CustomLoader.getHibernateType(CustomLoader.java:161)

              at org.hibernate.loader.custom.CustomLoader.autoDiscoverTypes(CustomLoader.java:131)

              at org.hibernate.loader.Loader.getResultSet(Loader.java:1678)

              at org.hibernate.loader.Loader.doQuery(Loader.java:662)

              at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)

              at org.hibernate.loader.Loader.doList(Loader.java:2145)

              at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2029)

              at org.hibernate.loader.Loader.list(Loader.java:2024)

              at org.hibernate.loader.custom.CustomLoader.list(CustomLoader.java:111)

              at org.hibernate.impl.SessionImpl.listCustomQuery(SessionImpl.java:1655)

              at org.hibernate.impl.AbstractSessionImpl.list(AbstractSessionImpl.java:142)

              at org.hibernate.impl.SQLQueryImpl.list(SQLQueryImpl.java:164)

              at com.dartfar.sdxl.dao.impl.LabourCostStatImpl.getList(LabourCostStatImpl.java:226)

              at test.test4.main(test4.java:22)

           

          if String sql="select c.mark, s.towerId, p.daysalary, c.workNum , c.planAttributeId  ,s.powerLevelId from person p,persondaycutplan c,PersonDayCutPlanEquipmentSdgq s  where  c.writerid=p.id and c.id=s.planId ";則不正確

          if String sql="select c.mark from person p,persondaycutplan c,PersonDayCutPlanEquipmentSdgq s  where  c.writerid=p.id and c.id=s.planId "; 則正確

          if String sql ="select distinct  towerId , id from persondaycutplanEquipmentsdgq where powerlevelId='"+powerlevelId+"'";也正確

           

          錯誤原因:person 表有錯誤,不知道什么原因,其他表格都可以。

           

                

          posted on 2008-07-17 20:55 wzy 閱讀(3189) 評論(1)  編輯  收藏

          評論

          # re: No Dialect mapping for JDBC type: 3 2008-12-18 11:40 huiwb

          試試指定類型。實例:query.addScalar("towerId", Hibernate.INTEGER);
            回復  更多評論   


          只有注冊用戶登錄后才能發表評論。


          網站導航:
           
          主站蜘蛛池模板: 达拉特旗| 建水县| 佛冈县| 仪陇县| 乌苏市| 远安县| 杨浦区| 西林县| 和硕县| 尤溪县| 宁乡县| 田阳县| 桂东县| 富民县| 民丰县| 洛浦县| 山丹县| 东兰县| 宽甸| 融水| 蒲江县| 灵璧县| 朝阳县| 维西| 长治市| 乌兰县| 河池市| 青浦区| 陕西省| 安福县| 新巴尔虎左旗| 莱芜市| 乐亭县| 琼海市| 佛教| 康平县| 颍上县| 商城县| 德格县| 阿瓦提县| 桦川县|