加入两个实体jpa spring postgresql

时间:2018-10-29 22:14:29

标签: spring postgresql-9.5

您好打算与两个实体进行联接以创建findById(),但我不明白为什么它总是一直在创建新列

解决了    select p.course from programs p join degrees d on p.degree = d.code group by p.course having count(*) = 1 and min(d.type) = 'UG';

@OneToOne
  @JoinColumn(name = "username")

// getter和setter

@Entity
@Table(name = "authorities")
public class RoleEntity implements Serializable {   
private static final long serialVersionUID = 1L;


@Id
@Column(name="username")
private String user_id;
@Column(length = 45, unique = true)
private String authority;

public RoleEntity(String user_id, String authority) {

    this.user_id = user_id;
    this.authority = authority;
}

public RoleEntity() {

}

// getter和setter

0 个答案:

没有答案