Hi all,

I have problem finding out how to specify the member of the composite key are 
foreign keys pointing to primary key of other tables. 
For example, If my composite key have 2 columns (A,B). I created wrapper like
public final class CompKey implements Serializable {
         private int A;
         private int B;

        public boolean equals(Object obj) {
          ..............
        }
        public int hashcode() {
           ...........
        }
}

Then in my class I will use 
 @IdClass(CompKey.class)
 @Entity
 public class MyClass implements Serializable{
        private int A;
        private int B;
        
 }



But now I want to specify A and B as foreign keys, how do I do that? I tried 
using @JoinColumn and add 2 more fields to class MyClass but that gives me 
error saying the column names A and B are repeated.


Can someone tell me how to specify A and B as foreign key but can still use 
them as composite key at the same time?


Thank you very much in advance,
Lngo

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4021009#4021009

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4021009
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to