View Javadoc
1   /*
2    * JBoss, Home of Professional Open Source
3    * Copyright 2014, Red Hat, Inc. and/or its affiliates, and individual
4    * contributors by the @authors tag. See the copyright.txt in the
5    * distribution for a full listing of individual contributors.
6    *
7    * Licensed under the Apache License, Version 2.0 (the "License");
8    * you may not use this file except in compliance with the License.
9    * You may obtain a copy of the License at
10   * http://www.apache.org/licenses/LICENSE-2.0
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.jboss.as.quickstart.hibernate3.model;
18  
19  import java.io.Serializable;
20  
21  import javax.persistence.Column;
22  import javax.persistence.Entity;
23  import javax.persistence.Id;
24  import javax.persistence.Table;
25  import javax.persistence.UniqueConstraint;
26  import javax.xml.bind.annotation.XmlRootElement;
27  
28  import org.hibernate.validator.Digits;
29  import org.hibernate.validator.Email;
30  import org.hibernate.validator.Length;
31  import org.hibernate.validator.NotEmpty;
32  import org.hibernate.validator.NotNull;
33  import org.hibernate.validator.Pattern;
34  
35  @Entity
36  @XmlRootElement
37  @Table(uniqueConstraints = @UniqueConstraint(columnNames = "id"), name = "MemberHibernate3")
38  public class Member implements Serializable {
39      /** Default value included to remove warning. Remove or modify at will. **/
40      private static final long serialVersionUID = 1L;
41  
42      @Id
43      private Long id;
44  
45      @NotNull
46      @Length(min = 1, max = 25)
47      @Pattern(regex = "[A-Za-z ]*", message = "must contain only letters and spaces")
48      private String name;
49  
50      @NotNull
51      @NotEmpty
52      @Email
53      private String email;
54  
55      @NotNull
56      @Length(min = 9, max = 12, message = "Size must be between 9 and 12 digits")
57      @Digits(fractionalDigits = 0, integerDigits = 12, message = "Not allowed digit!")
58      @Column(name = "phone_number")
59      private String phoneNumber;
60  
61      private String address;
62  
63      public Long getId() {
64          return id;
65      }
66  
67      public void setId(Long id) {
68          this.id = id;
69      }
70  
71      public String getName() {
72          return name;
73      }
74  
75      public void setName(String name) {
76          this.name = name;
77      }
78  
79      public String getEmail() {
80          return email;
81      }
82  
83      public void setEmail(String email) {
84          this.email = email;
85      }
86  
87      public String getPhoneNumber() {
88          return phoneNumber;
89      }
90  
91      public void setPhoneNumber(String phoneNumber) {
92          this.phoneNumber = phoneNumber;
93      }
94  
95      public String getAddress() {
96          return address;
97      }
98  
99      public void setAddress(String address) {
100         this.address = address;
101     }
102 }