Last active
October 30, 2021 08:50
-
-
Save nakamura-to/fac298a81966ce283589eb8647a41039 to your computer and use it in GitHub Desktop.
Domaで@embeddableの代替策
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
public class Address { | |
public String ctiy; | |
public String street; | |
public Address(String city, String street) { | |
this.city = ctiy; | |
this.street = street; | |
} | |
} |
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
@Entity | |
public class Emp { | |
private String ctiy1; | |
private String street1; | |
private String ctiy2; | |
private String street2; | |
public Address getAddress1() { | |
return new Address(city1, street1); | |
} | |
public void setAddress1(Address address) { | |
ctity1 = address.city; | |
street1 = address.street; | |
} | |
public Address getAddress2() { | |
return new Address(city2, street2); | |
} | |
public void setAddress2(Address address) { | |
ctity2 = address.city; | |
street2 = address.street; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment