-->
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.  [ 3 posts ] 
Author Message
 Post subject: Using composite element in saving a set
PostPosted: Mon Feb 07, 2005 8:53 pm 
Newbie

Joined: Mon Feb 07, 2005 8:48 pm
Posts: 6
hi all!

I having problems saving a collection while saving an object.

i have object order that has Set of items which i want to save with each order:

I'm using xdoclet to generate hibernate configs.

/**
* @hibernate.set name="items" table="CART_ITEMS"
* @hibernate.collection-composite-element class="org.petsoar.cart.CartItem"
* @hibernate.collection-key column="ORDER_ID"
**/
public Set getItems() {
return items;
}

public void setItems(Set items) {
this.items = items;
}


what i want to accomplish is to have each time an order is saved - to save a list of items into table cart_items,

most particularly im interested in saving individual item's quantity and SKU

any ideas why following is not working ?

maybe i need a different approach, i'm pretty new to hibernate


Top
 Profile  
 
 Post subject: children save issue
PostPosted: Tue Feb 08, 2005 12:21 pm 
Newbie

Joined: Mon Feb 07, 2005 3:17 pm
Posts: 4
I have had similar problems. What is the error that you are getting? If you remove RI from your database tables, this might help you.

Are you in a session bean for your commit? Or another type of transaction?


Top
 Profile  
 
 Post subject:
PostPosted: Tue Feb 08, 2005 3:11 pm 
Newbie

Joined: Mon Feb 07, 2005 8:48 pm
Posts: 6
i'm not getting any errors, but the collection is not being saved into table.

maybe some one can just suggest a way to do what i need as i am not sure that my solution is the right one,

i have order object that i'm saving and each order will have a Set of items
the getItems() method return a subclass of HashSet that contains my cart items.

i need each item to be written to a separate table along with order_id, but it can't just be an item id - it should also have quantity and sku


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

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.