Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 11th, 2012  |  syntax: None  |  size: 0.87 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Issue loading model data from YAML file
  2. #test data
  3.  
  4.    User(marchaos):
  5.        username:     marchaos
  6.        email:        marchaos@email.com
  7.        passwordHash: cf6dd541822b1b3d2d23c92adda75211
  8.        
  9. @Entity
  10. public class User extends Model
  11. {
  12.     @Unique
  13.     @Required
  14.     private final String username;
  15.  
  16.     @Email
  17.     @Required
  18.     private final String email;
  19.  
  20.     @Required
  21.     private final String passwordHash;
  22.  
  23.     public User(String username, String email, String password)
  24.     {
  25.         this.username = username;
  26.         this.email = email;
  27.             //TODO: salt
  28.         this.passwordHash = Codec.hexMD5(password);
  29.     }
  30.  
  31.     public String getUsername()
  32.     {
  33.         return username;
  34.     }
  35.  
  36.     public String getEmail()
  37.     {
  38.         return email;
  39.     }
  40. }
  41.        
  42. Fixtures.loadModels("User.yml");
  43.        
  44. System.out.println(((User) User.all().first()).getUsername());
  45. // prints null