神秘的 J2ee 殿堂

          ·古之學者必有師·做學者亦要做師者·FIGHTING·

          問題集錦

          今天在頁面用logic:present去顯示時,并沒有用到任何bean:message卻報個:
          Cannot find message resources under key org.apache.struts.action.MESSAGE
          錯誤,在struts-config.xml配個默認的資源文件文件就可以了!奇怪

          hibernate版本問題:
          做一個hibernate簡單測試,代碼如下
          Test2.hhm.xml
              <class name="bean.Test2" table="Test2" schema="dbo" catalog="xiaoxiao">
                  
          <id name="id" type="java.lang.Integer">
                      
          <column name="ID" />
                      
          <generator class="increment" />
                  
          </id>
                  
          <property name="name" type="java.lang.String">
                      
          <column name="NAME" length="50" />
                  
          </property>
              
          </class>
          hibernate.cfg.xml
          <session-factory>
              
          <property name="connection.username">sa</property>
              
          <property name="connection.url">
                  jdbc:microsoft:sqlserver:
          //localhost:1433;DatabaseName=xiaoxiao
              </property>
              
          <property name="dialect">
                  org.hibernate.dialect.SQLServerDialect
              
          </property>
              
          <property name="myeclipse.connection.profile">sql2000</property>
              
          <property name="connection.password">sa</property>
              
          <property name="connection.driver_class">
                  com.microsoft.jdbc.sqlserver.SQLServerDriver
              
          </property>
              
          <property name="show_sql">true</property>
              
          <property name="current_session_context_class">thread</property>
              
          <mapping resource="bean/Test2.hbm.xml" />
          </session-factory>
          測試代碼:
                  Session session = HibernateSessionFactory.getSessionFactory()
                          .getCurrentSession();
                  session.beginTransaction();

          /*        List ha = new ArrayList();
                  // ha=session.createQuery("from Test").list();
                  ha = session.createCriteria(Test2.class).list();
                  for (Iterator it = ha.iterator(); it.hasNext();) {
                      Test2 test2 = (Test2) it.next();
                      System.out.println(test2.getName());
                  }
          */
          /*        Test2 test2=new Test2();
                  test2.setName("haha");
                  session.save(test2);
          */
                  
          /*        Test2 test2=(Test2)session.load(Test2.class, 3);
                  test2.setName("love you");
          */
                  
          /*        Test2 test2=(Test2)session.load(Test2.class, 3);
                  session.delete(test2);
          */
                  
                  session.beginTransaction().commit();
          其中HibernateSessionFactory類是用的myeclipse自動生成的那個HibernateSessionFactory.java
          發現:在3.1版本下能正常運行,但在3.0版本下,只能查,不能增刪改,不報任何錯誤。




          posted on 2007-09-15 23:01 月芽兒 閱讀(213) 評論(0)  編輯  收藏 所屬分類: J2EE學習心得

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 和田市| 西峡县| 策勒县| 阜宁县| 新河县| 惠州市| 桓仁| 广宁县| 江城| 河北区| 临海市| 驻马店市| 九龙城区| 综艺| 龙胜| 南江县| 芮城县| 南宫市| 汾阳市| 华亭县| 和林格尔县| 荔浦县| 陆河县| 东港市| 达日县| 济源市| 安国市| 宾阳县| 汽车| 庆云县| 德令哈市| 黄山市| 邵阳市| 呼图壁县| 恩平市| 临泽县| 孟村| 宁夏| 永安市| 茶陵县| 年辖:市辖区|