2008年8月7日

          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 閱讀(1787) | 評論 (8)編輯 收藏

          為什么我的myeclipse沒有創建Hibernate Mapping File的選項?

          如題,我裝的是6.5的

          posted @ 2008-10-14 21:32 anyStar 閱讀(1610) | 評論 (2)編輯 收藏

          jstl的配置

          1.到http://archive.apache.org/dist/jakarta/taglibs/standard/binaries/下載你所需的版本

          2.將jstl.jar和standard.jar拷貝到WEB-INF目錄下的lib文件里

          3.在WEB-INF目錄下新建一個tlds文件夾,將c.tld和c-rt.tld考進去

          4.在web.xml文件配置你所用到的標簽如下:

          <?xml version="1.0" encoding="UTF-8"?>
          <web-app version="2.5"
           xmlns="http://java.sun.com/xml/ns/javaee"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
           http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
           
          <taglib>
              <taglib-uri>http://java.sun.com/jstl/core</taglib-uri>
              <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
          </taglib>

          <taglib>
              <taglib-uri>http://java.sun.com/jstl/core-rt</taglib-uri>
              <taglib-location>/WEB-INF/tlds/c-rt.tld</taglib-location>
          </taglib>

          ........................
          </web-app>

           

          posted @ 2008-09-18 20:30 anyStar 閱讀(1654) | 評論 (3)編輯 收藏

          運行servlet為什么總提示找不到文件

          我在Tomcat中文件路徑配置如下:webapps\servlet\WEB-INF\classes

          目錄下有一個TestServlet.class文件


          web.xml文件配置如下:

          <?xml version="1.0" encoding="ISO-8859-1"?>
          <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
                    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
                    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
                     version="2.4">
            <servlet>
              <servlet-name>TestServlet</servlet-name>
              <servlet-class>servlet.TestServlet</servlet-class>      
            </servlet>
            <servlet-mapping>
              <servlet-name>TestServlet</servlet-name>
              <url-pattern>/TestServlet</url-pattern>
            </servlet-mapping>
          </web-app>


          本人愚昧,整了將近一個小時仍然沒搞定,希望高手幫助一下

           

          posted @ 2008-08-11 17:33 anyStar 閱讀(1603) | 評論 (4)編輯 收藏

          學習中要注意的知識點及總結

          1,<meta>標簽是什么意思
          2.掌握JSP各種對象及其方法
          3.JSP對象所具有的相同的方法,及其用法區別
          4.迭代器使用的注意事項



          1--    meta其實是html語言head區的一個輔助性標簽。
                   meta標簽共有兩個屬性,它們分別是http-equiv屬性和name屬性,不同的屬性又有不同的參數值,這些不同的參數值就實現了不同的網頁功能。  
                    1、name屬性   
            name屬性主要用于描述網頁,與之對應的屬性值為content,content中的內容主要是便于搜索引擎機器人查找信息和分類信息用的。    
               2、http-equiv屬性     
            http-equiv顧名思義,相當于http的文件頭作用,它可以向瀏覽器傳回一些有用的信息,以幫助正確和精確地顯示網頁內容,與之對應的屬性值為content,content中的內容其實就是各個參數的變量值。

          2--  九種對象:request,response,out,seasion,pageContent,exception,application,config,page

          3--  待整理。。

          4--  在聲明迭代器之后,容器的大小是不能再改變的,否則會出錯。要想改變容器大小,應在聲明Iterator對象之前。

          posted @ 2008-08-07 16:45 anyStar 閱讀(281) | 評論 (0)編輯 收藏

          <2008年8月>
          272829303112
          3456789
          10111213141516
          17181920212223
          24252627282930
          31123456

          導航

          統計

          常用鏈接

          留言簿(2)

          隨筆分類

          隨筆檔案

          文章檔案

          搜索

          最新評論

          閱讀排行榜

          評論排行榜

          主站蜘蛛池模板: 永嘉县| 神农架林区| 和静县| 迁安市| 秭归县| 华池县| 绥芬河市| 衡山县| 库尔勒市| 静乐县| 朝阳市| 关岭| 隆尧县| 伊金霍洛旗| 建瓯市| 邯郸县| 察隅县| 腾冲县| 永新县| 忻州市| 马山县| 江阴市| 绥江县| 额尔古纳市| 吴堡县| 甘南县| 南溪县| 高碑店市| 惠州市| 紫阳县| 清苑县| 廉江市| 呼图壁县| 莱西市| 阳东县| 晋宁县| 墨玉县| 崇信县| 永登县| 巧家县| 开平市|