Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package org.radixware.manager.hibernateDAO.Config; import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; import org.springframework.security.crypto.bcrypt.BCrypt; /** * * @author Alena */ @Entity @Table(name = "user") public class UserEntity { @Id @Column(name = "name") String name; @Column(name = "pwd") String pwd; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPwd() { return pwd; } public void setPwd(String pwd) { this.pwd = BCrypt.hashpw(pwd, BCrypt.gensalt()); } public boolean isCorrectPassowrd(String password) { if (BCrypt.checkpw(password, this.pwd)) return true; else return false; } }