1、设置id
<id name="ID">
<!-- ????????????????? -->
<generator class="identity"/>
</id>
bean里面需设置id成int类型
2、配置hibernate日志,即时发现错误
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
3、hibernate对应的javabean需要有无参的构造函数,一般默认有,如果自己加了个无参的构造函数,就没了默认构造了