I have a bidirectional assoc one-to-many from User to Order. When I was trying to populate the database to see how it works with some data in it, I found that after several hundred orders (2 or 3 hundreds) for a user, adding an order to the order collection of a user takes 300, 400 msec. on a PIV 2GHZ Win XP, hibernate 2.1.4 on Win XP. The time spent loading the entire order collection of orders for the user before adding the order to it:
Order order = new Order();
order.setUser(user);
user.getOrders().add(order);
session.save(order);
Is there a way to avoid this, or to optimize it ? 300, 400 msec is quite a time for an insert isn't it ?
Thanks
|