-->
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: How to map in one class 2 collections of the same ITEM class
PostPosted: Fri Aug 01, 2008 5:56 am 
Newbie

Joined: Tue Mar 11, 2008 3:39 am
Posts: 8
Hello!

How to map in one main class (Person) 2 collections of the same ITEM class (PersonTransaction)?

Person
-> NewTransactions
- one1
- two1
-> OldTransactions
- one2
- two2

I need to put in 'item' table two foreign keys? How to do that?

Chris


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 01, 2008 6:19 am 
Newbie

Joined: Wed Jul 30, 2008 7:48 am
Posts: 10
Location: NOIDA
Try to design your database like below :-

Item :-
itemId(p.k.)
itemName

Person
personId(p.k.)
item1(F.k.)-->Item
item2(F.k.)-->Item

That means your pojos for above Two Tables will be like below:-

public class Item
{

private long itemId;
private String itemName;
// setter getter of all attributes

}

public class Person
{
private long personId;
private Item item1;
private Item item2;
// setter getter of all attributes
}


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.