Hibernate version:2
Oracle 9
Hi.
I am having a problem when I map a collection to a transfer object.
I have 2 TO's, like, Order and OrderItem:
class Order {
Integer idOrder;
}
class OrderItem {
Integer idOder;
Integer idOrderItem;
}
When I create an order, idOrder is crated by a sequence. So, if I instanciate an Order an populate it with OrderItems, i want hibernate to:
- get idOrder from the sequence and set on order (works fine)
- set idOrder from the Order TO on every OrderItem (I do not know how to do it)
When I needed to make it, I first created an Order (without any Item), iterated on every Item setting the order generated from the sequence, and then updated the Order. Is there a way to make it automatically?
Also, I have mapped every attribute in the TO (the "relationship" attributes also), because I need to display this data...
|