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

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

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

    2008年12月30日

    hibernate新手求助!!

    今天下午學習使用hibernate,跟著視頻做,可是控制臺老報這個錯誤
    02:03:12,171  WARN UserSuppliedConnectionProvider:23 - No connection properties specified - the user must supply JDBC connections
    02:03:12,171 ERROR SchemaExport:202 - schema export unsuccessful
    java.lang.UnsupportedOperationException: The user must supply a JDBC connection
     at org.hibernate.connection.UserSuppliedConnectionProvider.getConnection(UserSuppliedConnectionProvider.java:30)
     at org.hibernate.tool.hbm2ddl.ManagedProviderConnectionHelper.prepare(ManagedProviderConnectionHelper.java:28)
     at org.hibernate.tool.hbm2ddl.SchemaExport.execute(SchemaExport.java:180)
     at org.hibernate.tool.hbm2ddl.SchemaExport.create(SchemaExport.java:133)
     at com.test.hibernate.ExportDB.main(ExportDB.java:15)

    視頻就能運行成功,我的就不行,很是郁悶,

    hibernate.cfg.xml配置如下:
            

                <!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.connection.url ">jdbc:mysql:///localhost/hibernate_first</property>
                      <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
                      <property name="hibernate.connection.username">root</property>
                      <property name="hibernate.connection.password">root</property>
                      <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
      
                      <mapping resource="com/test/hibernate/User.hbm.xml"/>
                 </session-factory>
            </hibernate-configuration>

    實體類User的映射文件配置:
    <?xml version="1.0"?>
    <!DOCTYPE hibernate-mapping PUBLIC
     "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
    <hibernate-mapping>
     <class name="com.test.hibernate.User">
      <id name="id">
       <generator class="uuid"/>
      </id>
      
      <property name="userName"/>
      <property name="password"/>
      <property name="createDate"/>
      <property name="expireDate"/>
     </class>
     
    </hibernate-mapping>

    下面是連接數據庫的類:

    package com.test.hibernate;

    import org.hibernate.cfg.Configuration;
    import org.hibernate.tool.hbm2ddl.SchemaExport;

    public class ExportDB {


     public static void main(String[] args) {
      
      Configuration cfg = new Configuration().configure();
      
      SchemaExport export = new SchemaExport(cfg);
      
      export.create(true, true);
     }

    }


    希望路過高手不吝指導一下,感激不盡?。。?!

    posted @ 2008-12-30 02:23 anyStar 閱讀(1789) | 評論 (8)編輯 收藏

    <2008年12月>
    30123456
    78910111213
    14151617181920
    21222324252627
    28293031123
    45678910

    導航

    統計

    常用鏈接

    留言簿(2)

    隨筆分類

    隨筆檔案

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 2020国产精品亚洲综合网| 久久久久亚洲精品中文字幕| 久久亚洲日韩精品一区二区三区| 无人视频在线观看免费播放影院| 狼友av永久网站免费观看| 亚洲人成小说网站色| 国内自产少妇自拍区免费| 亚洲一区二区三区在线网站| 中文字幕无码视频手机免费看| 亚洲午夜久久久精品电影院| 成人无码区免费A片视频WWW | 亚洲无码精品浪潮| 青青草国产免费国产是公开| 亚洲中文字幕成人在线| 国产高清对白在线观看免费91 | 久久免费福利视频| 亚洲综合激情六月婷婷在线观看 | 亚洲精品久久无码| 又爽又黄无遮挡高清免费视频| 精品一区二区三区无码免费直播| 亚洲精品成人区在线观看| 久久嫩草影院免费看夜色| 亚洲AV无码国产精品色午友在线 | 性色午夜视频免费男人的天堂| 亚洲AV乱码久久精品蜜桃| 精品免费人成视频app| 亚洲一区二区无码偷拍| 亚洲国产精品碰碰| 免费视频成人片在线观看| 亚洲人成网站在线观看播放动漫| 免费羞羞视频网站| 成在人线av无码免费高潮喷水| 亚洲视频小说图片| 国产网站免费观看| 永久免费A∨片在线观看| 国产.亚洲.欧洲在线| 国产亚洲av片在线观看18女人| 亚洲视频免费在线播放| 精品成人一区二区三区免费视频| 久久精品国产亚洲AV麻豆王友容| 成人无码区免费A片视频WWW|