-->
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.  [ 2 posts ] 
Author Message
 Post subject: Confused about associations
PostPosted: Sat Dec 02, 2006 1:11 pm 
Newbie

Joined: Sat Dec 02, 2006 12:53 pm
Posts: 1
I have the following two persistent classes representing tables:

public class Item {
private int id;
private String item;
private String description;
private List components;
}

public class ItemComponents {
private int id;
private String parentItem;
private String componentItem;
private double quantityPerUnit;
}

I want to establish an association as follows (I will use SQL syntax:)
select * from ItemComponents
where ItemComponents.parentItem=Item.item

If tried the following mapping, but it does not work properly:

<class name "domain.Item" table="Item">
<id name="id" column="id" type="int">
<generator class="native"/>
</id>
<property name="item" type="string" column="item"/>
<property name="description" type="string" column="description"/>
<list name="components" table="ItemComponent">
<key column="item"/>
<one-to-many class="domain.ItemComponent" column="parentItem"/>
</list>
</class>

I assume this kind of association can be defined in Hibernate. What is the proper syntax?

Thank you


Top
 Profile  
 
 Post subject:
PostPosted: Sun Dec 03, 2006 6:30 pm 
Newbie

Joined: Sat Dec 02, 2006 10:55 pm
Posts: 10
Ive been working on a similar type of project

Word of advice, switch to using annotations instead of wasting time with the XML files


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 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.