读书人

hibernate question please help

发布时间: 2012-10-24 14:15:58 作者: rapoo

hibernate question please help.
Hi,

I have a question that bother me two days and I have no clue how it works.

Two object: orderItem, warehouseItem. OrderItem has reference to warehouseItem.
they both refer to an object called vendorInfo.

public class VendorInfo {
...
List<Guest> guests = new ArrayList<Guest>();

...
}

the mapping is in OrderItem.html.xml (as follows) but no mapping in (warehouseItem.hbm.xml):

OrderItem.hbm.xml:

<bag name="guests" table="order_item_unit" lazy="true" inverse="true" cascade="all">
<key column="order_item_id" />
<one-to-many />
</bag>

The question is when I commit a update transaction on warehouseItem, will the value of guests change? My obersavation is it is changed ( the id of guest is null now).
In the log I saw the update sql ( after I turn on the display sql). My question si why the guests is changed? The mapping is on the OrderItem, I debug and don't do any thing on the orderItem. ( the hiberation session I used to operate on warehouseItem is different with the hiberanation session of orderItem is using). How the id of guest become to null?

Sorry I can't try Chinese now but I need help desperately. If anybody can help please send me an email at this site.

Thank you very very much,
Ada

读书人网 >软件架构设计

热点推荐