This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JPA: is @PrimaryKeyJoinColumn(…) the same as @JoinColumn(…, insertable = ?, updatable = ?)?

 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone confirm (e.g. from the JPA spec) whether @PrimaryKeyJoinColumn(...), which doesn't have the insertable and updatable parameters, is the same as

@JoinColumn(..., insertable = false, updatable = false)

or

@JoinColumn(..., insertable = true, updatable = true)

when used on regular (non-inheritance) associations?

Should they be interchangable? What are the insertable and updatable properties set to? Are they set to anything at all? Note, I'm only targeting the read-only attribute that both (seem to) implement...

I'm getting rather inconsistent mapping exceptions with EclipseLink and Hibernate...

Here's the @PrimaryKeyJoinColumn JavaEE 5 + 6 Javadoc:

http://download.oracle.com/javaee/5/api/javax/persistence/PrimaryKeyJoinColumn.html
http://download.oracle.com/javaee/6/api/javax/persistence/PrimaryKeyJoinColumn.html

Quote: "... and it may be used in a OneToOne mapping in which the primary key of the referencing entity is used as a foreign key to the referenced entity."

Karsten
 
James Sutherland
Ranch Hand
Posts: 553
 
Karsten Wutzke
Ranch Hand
Posts: 106
Hibernate MySQL Database Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for helping on this! I'll have to file a few bug reports now.

Karsten
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic