小白求助,,Hibernate能不能一个类对应多个类
Hibernate能不能一个类映射多个类
public class RoomStyle implements Serializable {
private Integer id;
private String roomid;
private String roomname;
private String value;
private Pic pic;
private Set<Rooms> rooms = new HashSet<Rooms>();
public class Rooms implements Serializable{
private Integer id;
private String name;
private String document;
private RoomStyle roomStyle;
public class Pic implements Serializable{
private Integer id;
private String name;
private Rooms rooms;
可以映射关系吗?具体是??谢谢
------解决方案--------------------这个对应于数据库就是一对一(pic)和一对多(Rooms)
------解决方案--------------------可以的,其实还是根据你数据库的表设计来对类进行相应的映射的。