hibernated
hibernated copied to clipboard
@Embedded class fields are considered NotNull
class Customer {
int id;
string name;
// Embedded is inferred from type of Address
Address address;
this() {
address = new Address();
}
}
@Embeddable
class Address {
string zip;
string city;
}
If zip is not set, it's impossible to save object Customer c10 = new Customer(); c10.name = "Customer 10"; sess.save(c10); Fails on NotNull check for address.zip