icepeak:
?hibernate肯定沒什么問題的
?我也遇到啟動很慢的情況,都是我的問題
?你把你的映射文件發給我看看
icepeak:
?<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 2.0//EN" "?你用h3,但是卻寫h2的配置文件,h就傻了 把2變成3就好
icepeak:
?我想你得不到id也許和映射文檔有問題也有關系
?什么都不用改,就用identity,再試試看
?我覺得是映射文件配置錯誤導致了不能讀取
?就是2.0和3.0的錯誤
?
So...問題解決了.
俺用了三個批處理來自動生成hibernate的文件。
?
execant.bat:
d:
cd D:\hibernate-3.0\middlegen-2.1\samples\
rem 打開build.xml修改middlegen配置
editplus.exe build.xml
ant
?
myant.bat:
call execant.bat
pause
rem 復制hbm和java文件到工程目錄
xcopy .\build\gen-src\com\glacierbbs\hibernate\*.java E:\eclipse\workspace\JGlacier\src\com\glacierbbs\hibernate\ /Y /D
xcopy .\build\gen-src\com\glacierbbs\hibernate\*.xml E:\eclipse\workspace\JGlacier\src\ /Y /D
rem 替換掉hbm中的字符串
call E:\eclipse\workspace\JGlacier\cutter.bat
pause
?
cutter.bat:
e:
cd E:\eclipse\workspace\JGlacier\src
dir *.xml /d /b /a-d >hbmfiles.txt
rem 將版本2.0改成3.0
for /f %%i in (hbmfiles.txt) do strrpc /s:%%i 2.0 3.0 /c
rem 將hi/lo的max_lo由100改成0...我只需要簡單的數字
for /f %%i in (hbmfiles.txt) do strrpc /s:%%i 100 0 /c
del hbmfiles.txt>nul
rem 所有hi/lo算法讀的是同一個表中的不同字段
strrpc /s:Board.hbm.xml next_value next_boardid /c
strrpc /s:Post.hbm.xml next_value next_postid /c
strrpc /s:Topic.hbm.xml next_value next_topicid /c
strrpc /s:UserBasic.hbm.xml next_value next_userid /c
strrpc /s:Vote.hbm.xml next_value next_voteid /c
strrpc /s:VoteOption.hbm.xml next_value next_voteoptionid /c
strrpc /s:VoteParticipant.hbm.xml next_value next_voteparticipantid /c
cd ..
pause
?
然后,為每個hibernate生成的java類寫個Adapter類...從此世界就安靜了....