© Jorge Acetozi 2017

Jorge Acetozi, Pro Java Clustering and Scalability, https://doi.org/10.1007/978-1-4842-2985-9_16

16. New Account

Jorge Acetozi

(1)São Paulo / SP, Brazil

The following code is the User class . Along with the attributes declaration, you use the Bean Validation1 and Hibernate Validator2 annotations. A valid new user must have the following:

  • username: This must not be empty and must have between 5 and 15 characters. This field is the user database table’s primary key.

  • password: This must not be empty and must have a minimum of five characters.

  • name: This must not be empty.

  • email: This must not be empty and must be a valid e-mail address.

@Entity@Table(name = "user")public class User {  @Id  @NotEmpty  @Size(min = 5, max = 15)

Get Pro Java Clustering and Scalability: Building Real-Time Apps with Spring, Cassandra, Redis, WebSocket and RabbitMQ now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.