Created
October 23, 2012 12:58
-
-
Save petejohanson/3938591 to your computer and use it in GitHub Desktop.
Hibernate embedded class w/ toString()
This file contains 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
@Embeddable | |
public class Name { | |
public String getFirstName(); | |
void setFirstName(String firstName); | |
public String getLastName(); | |
void setLastName(String lastName); | |
@Override | |
public String toString() { | |
return firstName + " " + lastName; | |
} | |
} | |
@Entity | |
public class User { | |
@Embedded | |
public Name getName(); | |
void setName(Name name); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment