anonymous wrote : Please be aware that some browsers will repopulate some of 
the fields for you.
Maybe it's of interest that I redirect to a success page after submitting the 
form.

Here's the User entity:
@Entity
  | @Scope(ScopeType.SESSION)
  | @Name("user")
  | @Table(name="tzuser")
  | @javax.persistence.SequenceGenerator(
  |     name="s_tzuser",
  |     sequenceName="s_tzuser")
  | public class User implements Serializable
  | {
  |     private static final long serialVersionUID = 3366658268468153076L;
  |     
  |     public static enum UserStatus { ACTIVE, INACTIVE, REMOVED };
  | 
  |     protected Long id;
  | 
  |     protected String username;
  |     protected String checkPassword, password, password2;
  |     protected Set<Role> roles = new HashSet<Role>();
  |     
  |     protected String firstName;
  |     protected String lastName;
  |     protected String pseudonym;
  |     protected String emailAddr;
  |     
  |     protected String street;
  |     protected String zip;
  |     protected String city;
  |     protected String district;
  |     protected Country country;
  |     
  |     protected Date dob;
  |     
  |     protected Boolean emailAddrChecked = false;
  |     protected UserStatus status = UserStatus.ACTIVE;
  | 
  |     
  |     
  |     public User()
  |     {
  |     }
  | 
  |     @Override
  |     public String toString()
  |     {
  |             return firstName + " " + lastName + " (" + id + ")";
  |     }
  |     
  |     @Id @GeneratedValue(strategy=GenerationType.SEQUENCE, 
generator="s_tzuser")
  |     public Long getId()
  |     {
  |             return id;
  |     }
  | 
  |     public void setId(Long id)
  |     {
  |             this.id = id;
  |     }
  | 
  |     @ManyToMany(
  |                     targetEntity=Role.class,
  |                     cascade={CascadeType.PERSIST, CascadeType.MERGE, 
CascadeType.REFRESH}
  |     )
  |     @JoinTable(
  |                     name="user_role",
  |                     [EMAIL PROTECTED](name="fk_user")},
  |                     [EMAIL PROTECTED](name="fk_role")}
  |     )
  |     public Set<Role> getRoles()
  |     {
  |             return roles;
  |     }
  | 
  |     public void setRoles(Set<Role> roles)
  |     {
  |             this.roles = roles;
  |     }
  |     
  |     public void addRole(Role role)
  |     {
  |             this.roles.add(role);   
  |     }
  | 
  |     @NotNull
  |     public String getCity()
  |     {
  |             return city;
  |     }
  | 
  |     public void setCity(String city)
  |     {
  |             this.city = city;
  |     }
  | 
  |     @ManyToOne(cascade={CascadeType.PERSIST, CascadeType.MERGE, 
CascadeType.REFRESH})
  |     @JoinColumn(name="fk_country")
  |     public Country getCountry()
  |     {
  |             return country;
  |     }
  | 
  |     public void setCountry(Country country)
  |     {
  |             this.country = country;
  |     }
  | 
  |     public Date getDob()
  |     {
  |             return dob;
  |     }
  | 
  |     public void setDob(Date dob)
  |     {
  |             this.dob = dob;
  |     }
  | 
  |     @NotNull
  |     public String getFirstName()
  |     {
  |             return firstName;
  |     }
  | 
  |     public void setFirstName(String firstName)
  |     {
  |             this.firstName = firstName;
  |     }
  | 
  |     @NotNull
  |     public String getLastName()
  |     {
  |             return lastName;
  |     }
  | 
  |     public void setLastName(String lastName)
  |     {
  |             this.lastName = lastName;
  |     }
  | 
  |     @NotNull
  |     @Length(min=2)
  |     public String getUsername()
  |     {
  |             return username;
  |     }
  | 
  |     public void setUsername(String username)
  |     {
  |             this.username = username;
  |     }
  | 
  |     @NotNull
  |     //@Length(min=8, max=30)
  |     public String getPassword()
  |     {
  |             return password;
  |     }
  | 
  |     public void setPassword(String password)
  |     {
  |             this.password = password;
  |     }
  | 
  |     //@Length(min=8, max=30)
  |     @Transient
  |     public String getPassword2()
  |     {
  |             return password2;
  |     }
  | 
  |     public void setPassword2(String password2)
  |     {
  |             this.password2 = password2;
  |     }
  | 
  |     //@Length(min=8, max=30)
  |     @Transient
  |     public String getCheckPassword() {
  |             return checkPassword;
  |     }
  | 
  |     public void setCheckPassword(String checkPassword) {
  |             this.checkPassword = checkPassword;
  |     }
  | 
  |     @NotNull
  |     public String getZip()
  |     {
  |             return zip;
  |     }
  | 
  |     public void setZip(String zip)
  |     {
  |             this.zip = zip;
  |     }
  |     
  |     public String getPseudonym()
  |     {
  |             return pseudonym;
  |     }
  | 
  |     public void setPseudonym(String pseudonym)
  |     {
  |             this.pseudonym = pseudonym;
  |     }
  | 
  |     @NotNull
  |     @Email
  |     public String getEmailAddr()
  |     {
  |             return emailAddr;
  |     }
  | 
  |     public void setEmailAddr(String emailAddr)
  |     {
  |             this.emailAddr = emailAddr;
  |     }
  | 
  |     @NotNull
  |     public Boolean getEmailAddrChecked()
  |     {
  |             return emailAddrChecked;
  |     }
  | 
  |     public void setEmailAddrChecked(Boolean emailAddrChecked)
  |     {
  |             this.emailAddrChecked = emailAddrChecked;
  |     }
  | 
  |     @NotNull
  |     public UserStatus getStatus()
  |     {
  |             return status;
  |     }
  | 
  |     public void setStatus(UserStatus status)
  |     {
  |             this.status = status;
  |     }
  | 
  |     public String getDistrict()
  |     {
  |             return district;
  |     }
  | 
  |     public void setDistrict(String district)
  |     {
  |             this.district = district;
  |     }
  | 
  |     public String getStreet()
  |     {
  |             return street;
  |     }
  | 
  |     public void setStreet(String street)
  |     {
  |             this.street = street;
  |     }
  | }

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

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

Reply via email to