java

位置:IT落伍者 >> java >> 浏览文章

JPA和hibernate对删除操作的不同[2]


发布日期:2021年04月29日
 
JPA和hibernate对删除操作的不同[2]

public void setDescription(String description) {

thisdescription = description;

}

public Set<Person> getPersons() {

return persons;

}

public void setPersons(Set<Person> persons) {

thispersons = persons;

}

public Long getId() {

return id;

}

public void setId(Long id) {

thisid = id;

}

@Override

public int hashCode() {

int hash = ;

hash += (id != null ? idhashCode() : );

return hash;

}

@Override

public boolean equals(Object object) {

// TODO: Warning this method wont work in the case the id fields are not set

if (!(object instanceof Department)) {

return false;

}

Department other = (Department) object;

if ((thisid == null && otherid != null) || (thisid != null && !thisidequals(otherid))) {

return false;

}

return true;

}

@Override

public String toString() {

return comhadesleejpaentityDepartment[id= + id + ];

}

}

[] [] [] [] []

               

上一篇:JPA和hibernate对删除操作的不同[3]

下一篇:Hibernate O/R映射三大基本定则[2]