I integrated successfully my Spring Hibernate backend with Jasypt. According to following entity class I have encrypted it's name field, due to encryption process take place now database student table's name column contains encrypted data.
I need to know,
1) When I write some DAO query for search some student by his name, whether I have to pass that search text as plain text or I have to encrypt that value too?
2) With DAO query when I list down all the students order by to their names, then it supposes to sort according to database level encrypted values or decrypt (real) values ( that mean Jasypt will decrypt those values for me)?
Thanks.
Entity class
@Entity
@Table(name = "student")
public class Student implements Serializable {
@Id
@GeneratedValue
@Column(name = "ID")
private Integer id;
@Type(type="encryptedString")
@Column(name = "name")
private String name;
}
DAO class
public interface StudentRepository extends CrudRepository<Student, Integer> JpaSpecificationExecutor<Student> {
public List<Student> findByName(String searchText);
public List<Student> findAll(null, (new Sort(Direction.ASC, "name")));
}