一对一共享主键
下面我们直接通过实例来讲解共享主键配置:
主键主控方:Article
package com.zeng2.model;
@Table(name = "t_article2")
@Entity
public class Article {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Integer id;
private String title;
@OneToOne(cascade = CascadeType.ALL,fetch = FetchType.LAZY,optional = false)