HTML and CSS Reference
In-Depth Information
MegaUser other = (MegaUser) object;
if ((this.id == null && other.id != null) || (this.id != null &&
!this.id.equals(other.id))) {
return false;
}
return true;
}
@Override
public String toString() {
return "com.jsfprohtml5.megaapp.model.MegaUser[ id=" + id + " ]";
}
}
MegaUser JPA entity class has the following attributes:
id : Marked as a primary key for the entity using @Id annotation. It is validated to be between
3 and 64 characters.
firstName : Validated to be not null. It is validated to be between 3 and 32 characters.
lastName : Validated to be not null. It is validated to be between 3 and 32 characters.
password : Validated to be not null. It is validated to be between 6 and 32 characters
userGroupList : Represents the associated groups of the user and its cascade type is set to “All”,
which means that all of the operations (merge, persist, remove, refresh) will be cascaded
(as shown in Listing 13-8, the user belongs to one group).
bookRequestList : Represents the associated book requests of the user and its cascade type
is set to “All”, which means that all of the operations (merge, persist, remove, refresh) will be
cascaded.
password2 attribute in MegaUser entity class is used in order to confirm password entrance in the registration
page. as shown, the attribute is annotated with @Transient annotation to indicate that this field not persistent.
Note
UserGroup JPA entity class maps to the USER_GROUP table, which maps the application users to the application
groups as shown in Listing 13-10.
Listing 13-10. UserGroup JPA Entity Class
package com.jsfprohtml5.megaapp.model;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
 
Search WWH ::




Custom Search