神秘的 J2ee 殿堂

          ·古之學(xué)者必有師·做學(xué)者亦要做師者·FIGHTING·

          問題集錦

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

          hibernate版本問題:
          做一個(gè)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自動生成的那個(gè)HibernateSessionFactory.java
          發(fā)現(xiàn):在3.1版本下能正常運(yùn)行,但在3.0版本下,只能查,不能增刪改,不報(bào)任何錯(cuò)誤。




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

          導(dǎo)航

          統(tǒng)計(jì)

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          相冊

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 江华| 莱西市| 孙吴县| 昌吉市| 始兴县| 松潘县| 咸阳市| 新宁县| 通城县| 土默特右旗| 清丰县| 连城县| 馆陶县| 宜宾市| 宁武县| 探索| 安阳县| 蓝田县| 滦南县| 襄樊市| 萨迦县| 临西县| 高青县| 吉安县| 子长县| 青海省| 车致| 抚宁县| 崇礼县| 静安区| 保德县| 乌拉特中旗| 大安市| 江北区| 自治县| 临沭县| 报价| 乌苏市| 深圳市| 扶余县| 织金县|