我有一个网站用户的更新页面。 user
的某些列在枚举中编码。 user
的所有信息都转到POJO,所有列都经过哈希处理。
我的问题是,当我打开此更新页面并更新任何user
的某些信息时,它可以成功运行。但是,当我在另一台计算机上打开此网页时,更新过程无法正常运行。
我使用'system.out.println'查看了列的哈希码,我看到两个不同的计算机在列中生成了两个不同的哈希码,这些哈希码是用枚举库完成的。
我希望我的问题很明确。谢谢你的回复。
@Override
public int hashCode() {
int hash = 3;
hash = 79 * hash + (this.getId() != null ? this.getId().hashCode() : 0);
hash = 79 * hash + (this.kullaniciTipi != null ? this.kullaniciTipi.hashCode() : 0);
hash = 79 * hash + (this.kullaniciAdi != null ? this.kullaniciAdi.hashCode() : 0);
hash = 79 * hash + (this.parola != null ? this.parola.hashCode() : 0);
hash = 79 * hash + Arrays.hashCode(this.parmakIzi);
hash = 79 * hash + (this.zamanAsimi != null ? this.zamanAsimi.hashCode() : 0);
hash = 79 * hash + (this.tcKimlikNo != null ? this.tcKimlikNo.hashCode() : 0);
hash = 79 * hash + (this.adiSoyadi != null ? this.adiSoyadi.hashCode() : 0);
hash = 79 * hash + (this.epostaAdresi != null ? this.epostaAdresi.hashCode() : 0);
hash = 79 * hash + (this.ekranKisayol != null ? this.ekranKisayol.hashCode() : 0);
hash = 79 * hash + (this.hataliGirisSayisi != null ? this.hataliGirisSayisi.hashCode() : 0);
hash = 79 * hash + Objects.hashCode(this.durum);
hash = 79 * hash + (this.durum != null ? this.durum.hashCode() : 0);
System.out.println("id : " + this.getId() + "id hash : " +this.getId().hashCode());
System.out.println("zid : " + this.zamanAsimi + "zid hash : " +this.zamanAsimi.hashCode());
System.out.println("this.kullaniciTipi.hashCode()" + this.kullaniciTipi.hashCode());
System.out.println("this.kullaniciAdi.hashCode()" + this.kullaniciAdi.hashCode());
System.out.println("this.parola.hashCode()" + this.parola.hashCode());
// System.out.println("this.parmakIzi.hashCode()" + this.parmakIzi.hashCode());
System.out.println("this.zamanAsimi.hashCode()" + this.zamanAsimi.hashCode());
System.out.println("this.tcKimlikNo.hashCode()" + this.tcKimlikNo.hashCode());
System.out.println("this.adiSoyadi.hashCode()" + this.adiSoyadi.hashCode());
System.out.println("this.epostaAdresi.hashCode()" + this.epostaAdresi.hashCode());
// System.out.println("this.ekranKisayol.hashCode()" + this.ekranKisayol.hashCode());
System.out.println("this.hataliGirisSayisi.hashCode()" + this.hataliGirisSayisi.hashCode());
System.out.println("this.durum.hashCode()" + this.durum.hashCode());
System.out.println("sistem hash : " +hash);
return hash;
}
答案 0 :(得分:3)
问题在于: