Java Reference
In-Depth Information
@Column(name = "ADDRESS_ID")
private Integer addressId;
@Size(max = 100)
@Column(name = "ADDR_LINE_1")
private String addrLine1;
@Size(max = 100)
@Column(name = "ADDR_LINE_2")
private String addrLine2;
@Size(max = 100)
@Column(name = "CITY")
private String city;
@Size(max = 5)
@Column(name = "ZIP")
private String zip;
@JoinColumn(name = "ADDRESS_TYPE_ID",
referencedColumnName = "ADDRESS_TYPE_ID")
private AddressType addressType;
@JoinColumn(name = "CUSTOMER_ID",
referencedColumnName = "CUSTOMER_ID")
private Customer customer;
@JoinColumn(name = "US_STATE_ID",
referencedColumnName = "US_STATE_ID")
private UsState usState;
//generated methods and constructors omitted for brevity
Notice that the Address entity has a customer field. This field is of the type
Customer , the entity we were just discussing.
Had we left the Use Column Names in Relationships checkbox
checked in the Entity Classes from Database wizard, the generated
customer field would have been named customerId . In most
cases, unchecking this checkbox results in saner names for fields
used in entity relationships, as was the case here.
Search WWH ::

Custom Search