标签:public hiberna uid log UI join version table generated
@Entity
@Table(name = "photoGroup")
public class PhotoGroup implements Serializable{
private static final long serialVersionUID = -142542213293758421L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "photoGroupId")
private int photoGroupId;
@ManyToMany(mappedBy="photoGroup",fetch = FetchType.EAGER) //
private Set<Photo> photo;
}
@Entity
@Table(name = "photo")
public class Photo implements Serializable {
private static final long serialVersionUID = -73267813341118015L;
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "photoid")
private int photoid;
@ManyToMany(fetch = FetchType.EAGER)
@JoinTable(name = "photo_photoGroup", joinColumns = @JoinColumn(name = "photoid"), inverseJoinColumns = @JoinColumn(name = "photoGroupId"))
private Set<PhotoGroup> photoGroup;
}
参考博客:http://blog.csdn.net/jikak1153/article/details/43865701
标签:public hiberna uid log UI join version table generated
原文地址:http://www.cnblogs.com/bigot-Lee/p/6781057.html