0
我有以下三个简单的类。 我该如何着手在Rating.hbm.xml文件中映射Rating类和更具体的组合键? 我目前在hibernate文档中相当迷茫(5.1.2.1。复合标识符)如何在hbm.xml文件中的hibernate中创建复合主键
每个评分可以有一本书和一个用户进行特定评分。 每个用户可以做很多评级。 每本书都可以有很多评分。
类
评级类
public class Rating {
private User user;
private Book book;
private int rating;
private Date timestamp;
public Rating() {} //No arg contructor for hibernate
...
}
User类
public class User {
private long userId;
private String email, password;
public User() {}
...
}
Book类
public class Book {
private long bookId;
private String title;
public Book() {}
...
}
谢谢,我现在就试试。评级是否在RatingId类别上,而不在RatingBook类别中是否有任何理由? – James