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 閱讀(3190) 評論(1)  編輯  收藏

          評論

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

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


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


          網站導航:
           
          主站蜘蛛池模板: 阿克苏市| 永顺县| 扶余县| 安龙县| 庆阳市| 通许县| 邯郸县| 秭归县| 平南县| 迭部县| 南部县| 普安县| 浦县| 新安县| 海盐县| 龙游县| 沙田区| 陵水| 曲靖市| 彭泽县| 搜索| 龙陵县| 淮安市| 行唐县| 开平市| 黄浦区| 准格尔旗| 修文县| 泰兴市| 钟山县| 隆化县| 同江市| 平江县| 镇沅| 曲阳县| 铁岭市| 宁都县| 武胜县| 民乐县| 二连浩特市| 治县。|