The location table has a PK made up of 3 FK fields. The only way that I can successfully add a row to the location table is if I save the customer, email, and phone records first, build the LocationId myself, associate it to the location class and then call session.save(location).
Phone phone = new Phone();
phone.setPhoneNumber("330-555-1212");
session.save(phone);
Email email = new Email();
email.setEmailAddr("
[email protected]");
session.save(email);
Location loc = new Location();
LocationId id = new LocationId(cust, email, phone);
loc.setId(id);
loc.setAddress("999 Third Street");
loc.setCity("Younstown");
loc.setName("Younstown Office");
loc.setState("OH");
loc.setZip("44514");
session.save(loc);
...
// To access I have to go through the id.
Customer c = (Customer)session.load(Customer.class, 1);
for (Iterator i = c.getLocations().iterator(); i.hasNext();) {
Location loc = (Location)i.next();
System.out.println(loc.getAddress());
System.out.println(loc.getId().getEmail().getEmailAddr());
System.out.println(loc.getId().getPhone().getPhoneNumber());
}