<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 165, comments - 198, trackbacks - 0, articles - 1
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    2009年4月14日


    學習就從官方的測試開始,但不知道怎么回事官方的測試有問題,這我就把我配置的簡單junit環境共享給大家把!
    1.下載 hibernate-annotations-3.4.0.GA 并解壓 ,cd 到解壓后目錄下
    2. $>ant junit (天知道,怎么官方出的東西測試不能通過!!)
    ?? 不要急,我們來看錯誤 (錯誤提示有刪減)
    ???? 錯誤-1:$>build.xml:95: ./jdbc not found.
    ???? 解決辦法-1: $>mkdir ./jdbc
    3.? $>ant junit
    ???? 錯誤-2:?
    ????? ./build.xml:124: The following error occurred while executing this line:
    ????? ./build.xml:126: The following error occurred while executing this line:
    ????? ./common-build.xml:349: .\src\filters\hsqldb.filter as it doesn't exist.
    ???? 解決辦法-2:
    ?????? $>mkdir? ./src/filters ;
    ?????? $>echo "" > ./src/filters/hsqldb.filter;
    4. ? $>ant junit
    ???? 錯誤-3:
    ?????? ./build.xml:124: The following error occurred while executing this line:
    ?????? ./build.xml:126: The following error occurred while executing this line:
    ?????? ./common-build.xml:351: .\src\test-resources not found.
    ????? $>mkdir? ./src/test-resources ;
    5. ? $>ant junit
    ???? 錯誤-4:沒有ant 錯誤了!,但測試都為錯誤,那我們就看看 第一個測試吧,找下原因!
    ???????? test-resources:
    ????????? [mkdir] Created dir: hibernate-anntations-3.4.0.GA\build\test-reports\hsqldb
    ????????? [echo] Running against db: hsqldb
    ????????? [junit] Running org.hibernate.test.annotations.ConfigurationTest
    ????????? [junit] Tests run: 7, Failures: 0, Errors: 6, Time elapsed: 1.218 sec
    ????????? .............
    ???? $>find . -name "ConfigurationTest.java"? #pwd /hibernate-anntations-3.4.0.GA
    ??????? ./test/org/hibernate/test/annotations/configuration/ConfigurationTest.java
    ??????? ./test/org/hibernate/test/annotations/ConfigurationTest.java
    ????? 根據路徑 org.hibernate.test.annotations.ConfigurationTest
    ????? gvim? ./test/org/hibernate/test/annotations/ConfigurationTest.java
    ????? 發現第20行: cfg.configure( "org/hibernate/test/annotations/hibernate.cfg.xml" );
    ????? 感覺應該沒有配置 jdbc
    ????? gvim ./test/org/hibernate/test/annotations/hibernate.cfg.xml? #果然 沒配置
    ????? 我這就放個我的簡單配置上來(使用 hbm hsqldb 內存數據庫測 試 ):
    <!DOCTYPE?hibernate-configuration?PUBLIC
    ????????"-//Hibernate/Hibernate?Configuration?DTD?3.0//EN"
    ????????"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"
    >
    <hibernate-configuration>
    ??
    <session-factory>
    ????????
    <property?name="hibernate.dialect">org.hibernate.dialect.HSQLDialect</property>
    ????????
    <property?name="connection.driver_class">org.hsqldb.jdbcDriver</property>
    ????????
    <property?name="connection.url">jdbc:hsqldb:mem:hbn_ann</property>
    ????????
    <property?name="connection.username">sa</property>
    ????????
    <property?name="connection.password"></property>
    ???
    ????????
    <mapping?resource="org/hibernate/test/annotations/Boat.hbm.xml"/>
    ????????
    <mapping?package="org.hibernate.test.annotations"/>
    ????????
    <mapping?class="org.hibernate.test.annotations.Plane"/>
    ??
    </session-factory>
    </hibernate-configuration>


    ????? 我這就是要hsqldb吧,既然上面錯誤1有 jdbc 文件夾,那就是放 jdbc jar 的地方
    ????? $> cp ../hsqldb.jar? ./jdbc
    ???
    6. ? $>ant junit
    ???? 呵呵 測試 第一個正確了 ! (目前配置后,測試環境并不是全部都正確,比如第2個測試)
    ???? 其他測試錯誤日志在??? .\build\test-reports\hsqldb ...
    ???? 比如第2個錯誤 異常部分
    ????? org.hibernate.HibernateException: The dialect was not set. Set the property hibernate.dialect.
    ??? at org.hibernate.dialect.Dialect.instantiateDialect(Dialect.java:256)
    ??? at org.hibernate.dialect.Dialect.getDialect(Dialect.java:234)
    ??????? ........ 大家一邊學習,一邊配置測試 環境吧。
    ??? 錯誤日記 都會在 build\test-reports\hsqldb下

    posted @ 2009-04-14 11:30 G_G 閱讀(1672) | 評論 (0)編輯 收藏

    主站蜘蛛池模板: 国产av无码专区亚洲av桃花庵| 国产一区二区三区在线观看免费| 337p日本欧洲亚洲大胆裸体艺术| 大桥未久亚洲无av码在线| 免费激情视频网站| 亚洲国产成人手机在线观看| 国产va免费精品观看精品 | 蜜桃视频在线观看免费网址入口| 亚洲综合免费视频| 69xx免费观看视频| 久久亚洲精品国产精品婷婷| 成熟女人特级毛片www免费| 亚洲hairy多毛pics大全| 午夜国产大片免费观看| 一级特黄aaa大片免费看| 久久久青草青青国产亚洲免观| 在线播放免费人成毛片乱码| 亚洲AV成人片色在线观看高潮 | 亚洲欧洲AV无码专区| 日本高清免费不卡在线| 偷自拍亚洲视频在线观看| 国产亚洲人成网站在线观看| 日本高清高色视频免费| 亚洲一级片在线观看| 国产免费久久精品| 中文无码成人免费视频在线观看| 亚洲成a人片7777| 四虎成人精品在永久免费| 精品久久久久久国产免费了 | 国产精品综合专区中文字幕免费播放 | 亚洲电影唐人社一区二区| 无码人妻精品一二三区免费| 美女视频黄视大全视频免费的| 久久精品国产精品亚洲| 亚洲高清免费在线观看| 亚洲成AV人影片在线观看| 国外亚洲成AV人片在线观看| 国产成人精品免费视频网页大全| 亚洲日韩在线中文字幕综合| 久久久久无码精品亚洲日韩 | 免费观看大片毛片|