Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@ManyToOne & @JoinColumn

 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 A.id 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
 
Musab Al-Rawi
Ranch Hand
Posts: 231
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic