-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: How should I map a collection?
PostPosted: Thu May 11, 2006 10:49 am 
Newbie

Joined: Thu May 11, 2006 10:34 am
Posts: 1
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...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.