File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Object Relational Mapping and the fly likes Multiple Column Join Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » Object Relational Mapping
Bookmark "Multiple Column Join" Watch "Multiple Column Join" New topic
Author

Multiple Column Join

Michelle Streeter
Ranch Hand

Joined: Sep 22, 2011
Posts: 87

I have class A, class B, and Class C. B is a child of A and C is a child of B. The classes listed below are the ones created by JPA. But I got an error on the reference from C to B as generated. So then I changed the C class to the second list of C below and it compiled. But when I published to Glassfish, I get an error and JPA didnt like it. Could someone please help here?



Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Please use code tags for your code. Also, what is the exact error you're getting?
Michelle Streeter
Ranch Hand

Joined: Sep 22, 2011
Posts: 87

Well, I found the problem with the above scenario just after I posted the question. add , nullable=false, updatable=false to the JoinColmn reference and it worked.
Michelle Streeter
Ranch Hand

Joined: Sep 22, 2011
Posts: 87

Wondering how I unmark this resolved. At first I thought I found the answer but evidently not. The app had both my real code and the ABC example. So when it stopped failing on the ABC, I thought it was resolved but once I changed my real code like the ABC, then new issues came up. So, do I create a new question or do we go on with what I did post?
Vijitha Kumara
Bartender

Joined: Mar 24, 2008
Posts: 3860

Michelle Streeter wrote:...So, do I create a new question or do we go on with what I did post?

What's the new issues (with exceptions etc...) you face now?

And make sure to use code tags (UseCodeTags) next time posting code. I've edited this time for you...


SCJP 5 | SCWCD 5
[How to ask questions] [Twitter]
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Multiple Column Join