hibernate联合主键,调用saveOrUpdate(entity)问题

悬赏:5 发布时间:2008-07-25 提问人:yunsong (初级程序员)

由于是历史系统的原因,使用了联合主键
<class name="com..TtTrailerRoute" table="TT_TRAILER_ROUTE" schema="xx">
        <composite-id name="id" class="com..TtTrailerRouteId">
            <key-property name="routeId" type="int">
                <column name="ROUTE_ID" precision="8" scale="0" />
            </key-property>
            <key-property name="trailerId" type="int">
                <column name="TRAILER_ID" precision="8" scale="0" />
            </key-property>
        </composite-id>
    </class>
调用session.saveOrUpdate(TtTrailerRoute),发现Hibernate先执行了select, 再执行insert,这样做一个insert多执行了一条sql语句,请问大家遇到过这样的问题没有,怎么解决的
该问题已经关闭: close