Whats the preferred solution to this:

Given:

  | @Entity
  | @Name("user")
  | public class User implements Serializable {
  | ...
  | 
  |     @NotNull(message="required")
  |     @Length(min = 5, max = 15)
  |     public String getPassword() {
  |             return password;
  |     }
  | 
  |     public void setPassword(String password) {
  |             this.password = password;
  |     }
  | ...
  | }
  | 

What I REALLY want to do is this:

  | @Entity
  | @Name("user")
  | public class User implements Serializable {
  | 
  |     @In(create=true)
  |     EncryptionControllerI encryptionController;
  | 
  | ...
  | 
  |     @NotNull(message="required")
  |     @Length(min = 5, max = 15)
  |     public String getPassword() {
  |             return encryptionController.decrypt(password);;
  |     }
  | 
  |     public void setPassword(String password) {
  |                 this.password = encryptionController.encrypt(password);
  |     }
  | ...
  | }
  | 

Now you can't (it seems) inject into entity beans...

So I move the encryption outside the bean... 
but now that makes my password over the 15 limit... so when I try to save it 
then I cant...

so I make the max = 15 into max = 30 to accommodate the bigger crypted 
password... but then some moron puts a password in that 30 !! so that won't 
work.

I wanted to cryption to be as close to the @Entity as possible so the only 
other option is to move all the cryption code into the @Entity (which means it 
has to go to the OS to read the key and create the cyfer which is really poor 
as it will do it every time an @Entity is created).

Please advise.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4006564#4006564

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4006564
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to