@Embeddable public static class Recorder { @NotNull @Column(name = "`time`") public BigDecimal time; } }
@Embeddable public class PolicyId implements Serializable { @Column(name="`type`", length=32) String type; DependentId depPK; }
@Embeddable public class ShoppingBasketsPK implements Serializable { private static final long serialVersionUID = 4121297376338222776L; @ManyToOne(cascade={ CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinColumns({ @JoinColumn(name="customerID", referencedColumnName="customerID") }) @Basic(fetch= FetchType.LAZY) private Customers owner; @Column(name="basketDatetime", nullable=false) @Id private java.util.Date basketDatetime;
@Embeddable public class Name { @NotNull @Size(max = 40) private String firstName; @Size(max = 40) private String middleName; @Size(max = 40) private String lastName;
/** * @author Brett Meyer */ @Embeddable public class EmbeddableA { @Embedded @AttributeOverrides({@AttributeOverride(name = "embedAttrB" , column = @Column(table = "TableB"))}) private EmbeddableB embedB; private String embedAttrA; public EmbeddableB getEmbedB() { return embedB; } public void setEmbedB(EmbeddableB embedB) { this.embedB = embedB; } public String getEmbedAttrA() { return embedAttrA; } public void setEmbedAttrA(String embedAttrA) { this.embedAttrA = embedAttrA; } }
@Embeddable public static class Tuner { @NotNull public String frequency; }
@Embeddable public class PhoneDirectory @Column private String phoneDirectoryName; @Column private List<String> contactName; @Column @Size(message = "The size should be at least equal to one but not more than 2", min = 1, max = 2) private Map<String, String> contactMap;
/** * Test candidate for {@link Embeddable}. * * @author Stephane Nicoll */ @Embeddable public class SampleEmbeddable { }
@Embeddable public static class Identifier implements Serializable { private Integer id1; @Embedded private Identifier2 id2; public Identifier() { } public Identifier(Integer id1, Identifier2 id2) { this.id1 = id1; this.id2 = id2; } }
@Embeddable public class Version { @Basic private Integer major; @Basic private Integer minor;
@Embeddable public static class Phone { @Column private String mobile; public Phone() {} public Phone(String mobile) { this.mobile = mobile; } } //end::locking-jpa-query-hints-scope-entity-example[]
@Embeddable public class BasketItemsPK implements Serializable { @ManyToOne(cascade={ CascadeType.MERGE, CascadeType.PERSIST, CascadeType.REFRESH }) @JoinColumns({ @JoinColumn(name="basketDatetime", referencedColumnName="basketDatetime"), @JoinColumn(name="customerID", referencedColumnName="customerID") }) @Basic(fetch= FetchType.LAZY) private ShoppingBaskets shoppingBaskets; @Column(name="cost", nullable=false) @Id private Double cost;
@Embeddable public class EmployeeIdentity implements Serializable { @NotNull @Size(max = 20) private String employeeId; @NotNull @Size(max = 20) private String companyId;
@Embeddable public class PersonalDetailEmbedded @Column(name="PHONENO") private long phoneNo; @Embedded private PhoneDirectory phone;
@Accessors(chain = true) @NoArgsConstructor @AllArgsConstructor(staticName = "of") @EqualsAndHashCode @Embeddable public class Issue implements Serializable { @NonNull @NotNull @Getter private Long id; }
/** * @author Chris Cranford */ @Embeddable public class RoleExternal implements Role { public static String TYPE = "External"; @Override public String getType() { return TYPE; } }
@Embeddable public class ContactInfo { @ManyToOne(cascade = CascadeType.ALL) List<PhoneNumber> phoneNumbers; @Embedded SocialTouchPoints social;
@Embeddable public class Version { @Basic private Integer major; @Basic private Integer minor;