Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@JoinColumn annotation's name

 
Mark Garland
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

This could be me misunderstanding something, or could be one for the book errata...

I'm reading EJB In Action, pg 274-275.
"The @JoinColumn annotation's name refers to the name of the foreign key in the Users table".
In listing 8.7, it is "USER_BILLING_ID" but in Figure 8.4 it is "BILLING_ID".

Is this a simple mistake (doesn't appear on the errata I printed out in Feb), or is the "User" prefixed because that's the class name?

Thanks in advance,

MG
 
Amol Katyare
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
As described on pg - 275, If omitted, the "name" property takes the form -

<relationship field/property name>_<name of the referenced primary key column>

I think there is a print mistake on pg -274 when it says "The USERS table contains a foreign key named USERS_BILLING_ID that refers to BILLING_INFO tabel's BILLING_ID primary key".
USER_BILLING_ID should be read as just BILLING_ID (actual name of the column in USERS table)

And I wonder if the name="USER_BILLING_ID" should have been replaced by name="BILLINGINFO_BILLING_ID". Is it a print mistake again?

Could someone please confirm?
 
Deepika Joshi
Ranch Hand
Posts: 268
 
Amol Katyare
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Deepika. But it is not listed in book errata
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably related to the errata I have posted here.
 
Mark Garland
Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

Thank you Christophe - I hadn't spotted your errata - and that's a very useful link.

MG
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic