Hinernate進行mysql資料庫的逆向工程無法產生主外鍵關係,hinernatemysql

來源:互聯網
上載者:User

Hinernate進行mysql資料庫的逆向工程無法產生主外鍵關係,hinernatemysql


(1)我們在進行SSH開發大※的項目的時候,使用myeclipse內建的hibernate的逆向工程工具時,發現竟然無法產生one-to-one  one-to-many等的主外鍵關係,明明的資料庫建時已經有主外鍵關係了.為啥逆向產生時就不行了呢?

(2)首先說一下,我使用的是PHP開發環境Appserv內建的MySQL資料庫,不是單獨安裝的;

(3)這是因為資料庫引擎的問題,

我們可以在sql命令列中輸入命令:show engines;


可以看到default預設的是MyISAM;


(3)”MyISAM資料庫引擎不支援交易處理也不支援外來鍵”我們應該改為InnoDB類型的資料庫引擎;

(4)修改資料庫的引擎有兩種方法,一種是使用命令alter table 表名 type=InnoDB;來修改,但是我沒有嘗試成功;

第二種是在設定檔匯總找到my.ini檔案 ,一看就懂了   把注釋去掉 ,重新啟動資料庫就很好了


(5)但是使用這種方式的一種錯誤就是,會出現伺服器無法啟動的情況!




相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.