今天竟然遇到这样一个问题, 好好的tomcat, 执行上传的时候,

程序崩溃, 没有任何提示!没有异常!没有任何错误日志。。。

 

原因竟然是hibernate的这一行:

Department department = departmentService.queryByPK(Department.class, departmentId);

 

 hbm 文件如下:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
    <class name="net.sa.common.model.Department" table="sa_department">
        <id name="id" type="java.lang.Integer">
            <column name="department_id" />
            <generator class="native"></generator>
        </id>
        <property name="secondDepartmentId" type="java.lang.String">
            <column name="second_department_id"/>
        </property>
        <property name="secondParentId" type="java.lang.String">
            <column name="second_parent_id"/>
        </property>
        <property name="name" type="java.lang.String">
            <column name="department_name" length="50"/>
        </property>
        <property name="initials" type="java.lang.String">
            <column name="initials" length="100"/>
        </property>
        <property name="description" type="java.lang.String">
            <column name="department_description" length="255"/>
        </property>
        <property name="status" type="java.lang.Integer">
            <column name="status"/>
        </property>
        <property name="sequence" type="java.lang.Integer">
            <column name="sequence"  />
        </property>
        <property name="sequenceNo" type="java.lang.Integer">
            <column name="sequenceNo"  />
        </property>
        <property name="updStatusVer" type="long">
            <column name="updStatusVer"/>
        </property>
        <property name="displayName" type="java.lang.String">
            <column name="display_name"/>
        </property>
        <property name="address" type="java.lang.String">
            <column name="address"/>
        </property>
        <property name="telephone" type="java.lang.String">
            <column name="telephone"/>
        </property>
        <property name="path" type="java.lang.String">
            <column name="path"/>
        </property>
        <property name="grade" type="java.lang.Integer">
            <column name="grade"/>
        </property>
        <property name="storePoolId" type="java.lang.Long">
            <column name="storePoolId"/>
        </property>
        <many-to-one name="parent" class="net.sa.common.model.Department" lazy="false" insert="true" update="true" column="parent_id" not-found="ignore" ></many-to-one> 
        <!--  
        <set name="childs" lazy="false" inverse="true" cascade="none"
            order-by="sequence asc,sequenceNo asc,department_id asc" where="status&gt;=0">
            <key column="parent_id"></key>
            <one-to-many class="net.sa.common.model.Department" />
        </set>
        -->
    </class>
</hibernate-mapping>

 

因为每次查询department 会去获取其 parent,  而department 层级也就 10多层深, 竟然导致了 程序崩溃。。。。

 

 -Xss128k  改成  -Xss256k  之后, 好了!