DreamTiger的夢幻樂園

          隨便寫寫,自得其樂,生活就是這樣

            BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
            29 Posts :: 0 Stories :: 13 Comments :: 0 Trackbacks
          代碼一:
              DetachedCriteria dc = DetachedCriteria.forClass(classT, "p");
              dc.add(Restrictions.eq(
          "purePeptide", purePeptide));
              dc.add(Restrictions.eq(
          "project.id", projectId));
              dc.addOrder(Order.asc(
          "peptide"));

          代碼二:
              DetachedCriteria dc = DetachedCriteria.forClass(classT, "p");
              dc.add(Restrictions.eq(
          "p.purePeptide", purePeptide));
              dc.add(Restrictions.eq(
          "project.id", projectId));
              dc.addOrder(Order.asc(
          "peptide"));

          兩段代碼唯一的區別就是第二句是使用"purePeptide"還是"p.purePeptide"。
          代碼一產生的sql語句:
          select this_.purePeptide as y1_, this_.peptide as y2_ from SequestPeptide this_ where y1_ = 'NASILLEELDLEK' and this_.project_id=1 order by y2_ asc
          運行會報Unknown column name:Y1_

          代碼二產生的正確的sql語句:
          select this_.purePeptide as y1_, this_.peptide as y2_ from SequestPeptide this_ where this_.purePeptide='NASILLEELDLEK' and this_.project_id=1 order by y2_ asc
          posted on 2006-02-23 21:13 夢幻樂園 閱讀(1451) 評論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 睢宁县| 新和县| 江孜县| 克东县| 明水县| 桃园县| 娄底市| 香港 | 仙游县| 左贡县| 沁水县| 邻水| 射洪县| 工布江达县| 东丰县| 隆回县| 莲花县| 东台市| 文化| 麦盖提县| 故城县| 伊宁市| 那曲县| 常德市| 蛟河市| 旬邑县| 石狮市| 呼图壁县| 黄石市| 丰镇市| 西藏| 宜丰县| 荔波县| 双城市| 黄石市| 内江市| 米泉市| 娄烦县| 黄骅市| 封丘县| 汝城县|