日期:2014-05-18  浏览次数:20867 次

java.lang.NullPointerException 为什么会抛出来呀?
//表major的映射文件
<hibernate-mapping>
        <class   name= "com.crownsoft.qsm.bean.Major "   table= "major ">
                <id   name= "id "   type= "java.lang.String ">
                        <column   name= "id "   length= "2 "   />
                        <generator   class= "increment "   />
                </id>
                <property   name= "name "   type= "java.lang.String ">
                        <column   name= "name "   length= "20 "   not-null= "true "   />
                </property>
                <property   name= "shortname "   type= "java.lang.String ">
                        <column   name= "shortname "   length= "10 "   not-null= "true "   />
                </property>
                <property   name= "department "   type= "java.lang.String ">
                        <column   name= "department "   length= "4 "   not-null= "true "   />
                </property>
                <set   name= "classes "   inverse= "true "   cascade= "all ">
                        <key>
                                <column   name= "majorid "   length= "2 "   not-null= "true "   />
                        </key>
                        <one-to-many   class= "com.crownsoft.qsm.bean.Classes "   />
                </set>
        </class>
</hibernate-mapping>
//表classes的映射文件
<hibernate-mapping>
        <class   name= "com.crownsoft.qsm.bean.Classes "   table= "classes ">
                <id   name= "id "   type= "java.lang.Integer ">
                        <column   name= "id "   />
      &