title: Simple encryption (username - password) in JPA, mysql
body: <p>I am completely new in Java encryption and I need your help. I would like to implement a simple login system with mysql and JPA entity UserRecord:</p>
  
  <pre><code>    @Entity
      public class UserRecord implements Serializable {
      private static final long serialVersionUID = 1L;
      @Id
      @GeneratedValue(strategy = GenerationType.SEQUENCE)
      private Long id;
      @Column(unique=true)
      private String username;
      private String password;
  </code></pre>
  
  <p>Now, what is the best way to keep secret the system? I think, I have to encrypt the password and manage to decrypt it at the time of comparing the inputs with database records. Are there some special ways to make this in JPA? I want to create nothing difficult, it is only for my study issues. The only requirement: it has to be salted (?). Could you advice me, please?</p>
  
  <p>Thanks a lot!</p>