Created
February 14, 2014 20:18
-
-
Save sscovil/9008426 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Entity | |
@Table(name = "User") | |
public class User { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "id") | |
private Integer id; | |
@Column(name = "uuid") | |
private String uuid; | |
@OneToOne | |
@JoinColumn(name = "uuid", referencedColumnName = "frn_object_uuid") | |
private Foo foo; | |
@OneToOne(mappedBy = "user") | |
private Bar bar; | |
// getters and setters | |
} | |
@Entity | |
@Table(name = "Foo") | |
public class Foo { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "id") | |
private Integer id; | |
@Column(name = "frn_object_uuid") | |
private String objectUuid; | |
@Column(name = "foo") | |
private String foo; | |
// getters and setters | |
} | |
@Entity | |
@Table(name = "Bar") | |
public class Bar { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
@Column(name = "id") | |
private Integer id; | |
@Column(name = "frn_user_id") | |
private Integer userId; | |
@Column(name = "bar") | |
private String bar; | |
@OneToOne | |
@JoinColumn(name = "frn_user_id") | |
private User user; | |
// getters and setters | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment