hibernated icon indicating copy to clipboard operation
hibernated copied to clipboard

@Embedded class fields are considered NotNull

Open buggins opened this issue 7 years ago • 0 comments

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

buggins avatar Sep 16 '16 10:09 buggins