java - JPA @Transient fields being cleared before @PreUpdate method is called -


I have a user unit class for which I am trying to do the hashing password. I thought that the easiest way to do this would be to create an annotated password field with @transent and a hashead password field, which is made with the object @ predicist and @ annotated method with prior update.

So I have something like this:

  @ Transaction Private string password; Private string hashed password; @Prepresist @ Undo Private ZeroHashword () (if (password! = Null) {hashedPassword = PasswordHasher.hashPassword (password);}}  

This works perfectly fine when someone The unit remains the password field is still set by the hash password, and a value for the hashed password is calculated and stored.

However, this is not correct for an update - Even if a new value for the password was set before the unit was visited Or, at that time, the field is called zero hash password, why is it? Should not the prices of the temporary areas remain at least until the unit persists?

(I have Eclipse links 2.0.0 I am using BTW if it makes a difference)

I call it "transient" Resolved by setting updateable and insertable to make a mistake on the field, so your It would be met:

  @ Column (name = "password", inserted = false, updates to qualify = false) private String password; Therefore a table @ column is required (which is ugly), but it will never be filled (which was important for security reasons in my case). 

I Hibernate 4.3.4 Tested against the last and it worked for me. The field value was usable in my EntityLister @PrePersist and @UpUpdate methods, but was not stored in the database.

Hope anyone helps in having similar problems.


Comments

Popular posts from this blog

Eclipse CDT variable colors in editor -

AJAX doesn't send POST query -

wpf - Custom Message Box Advice -