Hi All,
I have a typical scenario. With Orders & Order items which links to a products table..
Whenever I create a new Order, I always end up with twice as many inserts in both the Orders and Order Items table.. Hoping someone might see an obvious error in my mapping..
I have the main Order mapping which has a many to many link with products forming the order_items.. which is defined as;
<set lazy="false" name="products" table="order_products">
<key column="orderSerial" />
<many-to-many column="productSerial" class="net.dbws.sandz.beans.Product"/>
</set>
and the product mapping is just a very straight forward mapping file with NO sets/or linkage references..
I have a DAO for the order and save the order using that.. I save using
session = factory.openSession();
session.saveOrUpdate(charge);
session.flush();
Can anyone see a problem with the mapping ? Any thoughts really appreciated. Thanks
|