DreamTiger的夢(mèng)幻樂園

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

            BlogJava :: 首頁(yè) :: 聯(lián)系 :: 聚合  :: 管理
            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"));

          兩段代碼唯一的區(qū)別就是第二句是使用"purePeptide"還是"p.purePeptide"。
          代碼一產(chǎn)生的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
          運(yùn)行會(huì)報(bào)Unknown column name:Y1_

          代碼二產(chǎn)生的正確的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 夢(mèng)幻樂園 閱讀(1446) 評(píng)論(0)  編輯  收藏 所屬分類: Java
          主站蜘蛛池模板: 建瓯市| 赣州市| 阳曲县| 江山市| 巧家县| 井冈山市| 绥江县| 体育| 手游| 汶上县| 黄梅县| 垫江县| 南宁市| 增城市| 顺昌县| 黎城县| 灵武市| 贺州市| 浮梁县| 丰宁| 云安县| 石狮市| 沙湾县| 保靖县| 香港| 永春县| 合阳县| 延津县| 呼图壁县| 黄石市| 兴隆县| 大田县| 新丰县| 商洛市| 高邑县| 买车| 正定县| 徐水县| 武强县| 手游| 乌兰县|