File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes @ManyToOne & @JoinColumn Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "@ManyToOne & @JoinColumn" Watch "@ManyToOne & @JoinColumn" New topic

@ManyToOne & @JoinColumn

Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
I am new to EJB and JPA and I need your help please.

Suppose that we have two Entities A (mapped to DB table A with Pk field named id)
and B (mapped to a DB table B with FK a_id that references in a many to one relationship)

in entity class A I have:

in entity class B I have:

Based on my understanding that should work but Eclipse is giving me referenced column "id" in join column"a_id" cannot be resolved.
I checked eclipse's manual and it says that i need to make sure that the column exists in DB and it does, so why am I getting that error?

Your help is greatly appreciated,

Musab Al-Rawi
Ranch Hand

Joined: Aug 06, 2007
Posts: 231
I posted this topic here, please answer it there (if you want to) as I think it would be more appropriate.
[ September 23, 2008: Message edited by: Musab Al-Rawi ]
I agree. Here's the link:
subject: @ManyToOne & @JoinColumn
It's not a secret anymore!