|
Page Edited :
openjpa :
Embeddable samples
Embeddable samples has been edited by Rick Curtis (Jun 11, 2009). Content:Nested EmbeddablesIn the code snippet below, there is a User Entity which has an embedded ContactInfo. ContactInfo contains two other embeddeded embeddables, Address and Phone.
@Embeddable
public class Address {
@Basic
private String street;
@Basic
private String city;
@Basic
private String state;
@Basic
private Integer zip;
public Address(){
}
//...
}
@Embeddable
public class Phone {
@Basic
private String number;
//...
}
@Embeddable
public class ContactInfo {
public ContactInfo(){
}
@Embedded
Address homeAddress;
@Embedded
Phone homePhone;
//...
}
@Entity
public class User {
@Id
private int id;
@Embedded
ContactInfo contactInfo;
public User(){
}
//...
}
Collections EmbeddablesRelationships Embeddables |
Powered by
Atlassian Confluence
(Version: 2.2.9 Build:#527 Sep 07, 2006)
-
Bug/feature request
Unsubscribe or edit your notifications preferences
Unsubscribe or edit your notifications preferences
