我有这个代码
ArrayList<String> city = '安妮斯顿';
Criteria crit = session.createCriteria(CandidateResumeInfo.class);
crit.add(Restrictions.eq("resumeSearchable", 1));
现在我想添加以下条件
crit.add(Restrictions.in("cities", city));
但问题是城市列不在CandidateResumeInfo.classCandidateInfo 类中。
知道如何在上述标准中添加此标准,以及如何CandidateInfo在上述标准中添加类。
猜想我需要加入或链接这两个表,但是如何,实体类会有什么变化?
这是我的 2 节课
@实体
@Table(name="candidateinfo")
公共类 CandidateInfo 实现 java.io.Serializable {
私人 int id;
私人字符串名;
私人字符串姓氏;
私人字符串城市;
私有字符串 stateProvince;
私人字符串 zip;
私有字符串国家;
私有集候选视频 = new HashSet();
私人字符串 yearsOfExperience;
私人字符串登录名;
私人字符串密码;
私有字符串地址;
私人字符串电子邮件地址;
私人 int 密码ResetQuestionId;
私人字符串密码重置答案;
私有字符串中间名;
私人字符串 homeEveningPhone;
私人字符串 workDayPhone;
私人布尔视频已提交;
私人布尔简历已提交;
私人字符串手机;
私有字符串可用性=null;
私人字符串工作状态=空;
私有字符串desiredSalary=null;
私有字符串 currentJobLevel=null;
私有字符串 currentJobTitle=null;
私有字符串 targetJobTitle=null;
私人字符串替代目标工作标题1 =空;
私人字符串替代目标工作标题2=空;
私有字符串 targetJobType=null;
私人字符串事件类型=空;
私有字符串 joinDate = null;
私有字符串 lastLoginDate = null;
//私有SkillsBean技能信息;
私有集合技能 = new HashSet();
私人集合候选人简历=新哈希集();
私有集 targetJobCategoriesId = new HashSet();
私人设置 targetJobLocationsId = new HashSet();
公共候选人信息(){
}
@Column(name="userid")
公共 int getId() {
返回这个.id;
}
@Column(name="登录名")
公共字符串 getLoginName() {
返回登录名;
}
公共无效setLoginName(字符串登录名){
this.loginName = 登录名;
}
@Column(name="密码")
公共字符串 getPassword() {
返回密码;
}
公共无效setPassword(字符串密码){
this.password = 密码;
}
@Column(name="地址")
公共字符串 getAddress() {
退货地址;
}
公共无效setAddress(字符串地址){
this.address = 地址;
}
..................................................... …………………………………………………………………………………………
@实体
@Table(name="candidateresumeinfo")
公共类 CandidateResumeInfo 实现 Serializable{
私人 int resumeId;
私人 int 候选人_用户 ID;
私人字符串恢复文件位置;
私人 int resumeSearchable;
私人日期 lastUpdateDate;
私人字符串恢复标题;
私有字符串恢复文本;
私人弦乐技巧;
私有 int 行计数;
@Column(name="resumeSearchable")
公共 int isResumeSearchable() {
返回简历可搜索;
}
公共无效 setResumeSearchable(int resumeSearchable) {
this.resumeSearchable = resumeSearchable;
}
@ID
@GeneratedValue
@Column(name="resumeid")
公共 int getResumeId() {
返回简历ID;
}
公共无效 setResumeId(int resumeId) {
this.resumeId = resumeId;
}
@Column(name="candidate_userid")
公共 int getCandidate_userId() {
返回候选人_用户ID;
}
公共无效 setCandidate_userId(int Candidate_userId) {
this.candidate_userId = Candidate_userId;
}
@Column(name="resumelocation")
公共字符串 getResumeFileLocation() {
返回恢复文件位置;
}
公共无效 setResumeFileLocation(字符串恢复文件位置){
this.resumeFileLocation = resumeFileLocation;
}
@Column(name="resumetitle")
公共字符串 getResumeTitle() {
返回简历标题;
}
公共无效setResumeTitle(字符串恢复标题){
this.resumeTitle = 恢复标题;
}
@Column(name="resumetext")
公共字符串 getResumeText() {
返回简历文本;
}
公共无效 setResumeText(字符串恢复文本){
this.resumeText = resumeText;
}
公共无效 setLastUpdateDate(日期 lastUpdateDate){
this.lastUpdateDate = 最后更新日期;
}
@Column(name="lastUpdateDate")
公共日期 getLastUpdateDate() {
返回最后更新日期;
}
@Column(name="技能")
公共字符串getSkills(){
回归技能;
}
公共无效 setSkills(字符串技能){
this.skills = 技能;
}
@短暂的
公共 int getRowCount() {
返回行数;
}
公共无效setRowCount(整数计数){
this.rowCount = 计数;
}