February 01 2013 by Kevin Bowersox
 

The following tutorial details how to configure a bidirectional and unidirectional one-to-one relationship within JPA.  The tutorial builds off of a project created in the previous post, Configuring Spring Data with MySql.  To follow along with this video, you can download the source code fro the previous post from the GitHub Repository.  Source code for the completed project can be downloaded by clicking the GitHub logo below.

Comments
Post a Comment
Oli commented on April 01 2013 22:03 PM
Hi there, in my test i found out, that the postpart is not stored in the database. I fix that by annotate the PostPart Reference with @OneToOne(optional = false, cascade = { CascadeType.ALL }) @JoinColumn(name = "POST_PART_ID", unique = true, nullable = false, updatable = false) otherwise the id of PostPart will be null and it would not be stored in the database. Are you agree with that??? regards
Post a Comment
*Name
Email
Site
*Comment