一、設置idjava
<id name="ID">
<!-- ????????????????? -->
<generator class="identity"/>
</id>
apache
bean裏面需設置id成int類型app
二、配置hibernate日誌,即時發現錯誤ide
log4j.rootLogger=debug,appender1 #log4j.rootLogger=info,appender1 #log4j.rootLogger=error,appender1 log4j.appender.appender1=org.apache.log4j.ConsoleAppender log4j.appender.appender1.layout=org.apache.log4j.SimpleLayout三、hibernate對應的javabean須要有無參的構造函數,通常默認有,若是本身加了個無參的構造函數,就沒了默認構造了