Created
March 3, 2015 06:04
-
-
Save oranheim/e21063f0a0002be95df0 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// User model | |
@Exclude | |
@XmlRootElement(name = "user") | |
@XmlAccessorType(XmlAccessType.PROPERTY) | |
@JsonIgnoreProperties(ignoreUnknown = true) | |
public class User extends Principal { | |
@Column(name = "USERNAME", nullable = false, length = 20) | |
public String getUsername() { | |
return this.username; | |
} | |
public void setUsername(String username) { | |
this.username = username; | |
} | |
@Column(name = "FIRSTNAME", length = 50, nullable = false) | |
@NotNull | |
@Size(min = 3, max = 50) | |
public String getFirstname() { | |
return firstName; | |
} | |
public void setFirstname(String firstName) { | |
this.firstName = firstName; | |
} | |
@Column(name = "LASTNAME", length = 50, nullable = false) | |
public String getLastname() { | |
return lastName; | |
} | |
public void setLastname(String lastName) { | |
this.lastName = lastName; | |
} | |
/* | |
If this getter is uncommented FasterXml Jackson throws | |
org.jboss.resteasy.spi.ReaderException: com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "user" Unrecognized field "user" (class com.parts.commons.model.user.User) | |
@Transient | |
@JsonIgnore | |
@JsonProperty("fullName") | |
public String getFullName() { | |
return firstName + ' ' + lastName; | |
} | |
*/ | |
// ... associations... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment