Jasypt Users Forum

 « Return to Thread: jasypt 1.5 + hibernate 3 annotations

jasypt 1.5 + hibernate 3 annotations

by cassey :: Rate this Message:

Reply to Author | View in Thread

hi. i used the jasypt but the password wasn't encrypted when saved to the table
dont know what's wrong. please help.

here's my code

import org.hibernate.annotations.Parameter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;
import org.jasypt.hibernate.type.EncryptedStringType;

@Table(name = "STAFF")
@TypeDef(
                name="encryptedString",
                typeClass=EncryptedStringType.class,
                parameters= {
                        @Parameter(name="encryptorRegisteredName", value="strongHibernateStringEncryptor")
                        }
                )
public class Staff {

// other attributes ommited

        @Column(name = "PASSWORD", nullable = false)
        private String password;

       @Type(type="encryptedString")
        public String getPassword() {
                return password;
        }

        public void setPassword(String password) {
                this.password = password;
        }
}

 « Return to Thread: jasypt 1.5 + hibernate 3 annotations