Skip to content

Instantly share code, notes, and snippets.

@petejohanson
Created October 23, 2012 12:58
Show Gist options
  • Save petejohanson/3938591 to your computer and use it in GitHub Desktop.
Save petejohanson/3938591 to your computer and use it in GitHub Desktop.
Hibernate embedded class w/ toString()
@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