-->
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: Mapping one table with other many time. how to?
PostPosted: Sat Apr 21, 2012 3:51 am 
Newbie

Joined: Sat Apr 21, 2012 3:43 am
Posts: 1
Hi all,

i have a scenario my first table contains master data with different codes
like
A Table
pk code description
1 1 car
2 1 truck
3 2 bike

and second table having first table reference twice
like
B Table
pk A A name
1 1 3 John
2 2 3 Max


How to write relation for this scenario annotation based.

Thank You


Top
 Profile  
 
 Post subject: Re: Mapping one table with other many time. how to?
PostPosted: Mon Apr 23, 2012 10:04 am 
Expert
Expert

Joined: Tue Jun 16, 2009 3:36 am
Posts: 990
@Entity
class B {

@ManyToOne
private A assA1;

@ManyToOne
private A assA2;

}


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.