Q:

Play Framework 2.1 and Ebean: model Finder returns no data

I've been banging my head around this for hours. I have two models:
@Entity
@Table(name = "app_user")
public class AppUser extends Model {

    @Id
    Long id;

    …

    @Constraints.Required
    @Valid
    @OneToOne(cascade = CascadeType.ALL, optional = false)
    public LocationAddress address;

    @Valid
    @OneToOne(cascade = CascadeType.ALL, optional = true)
    public LocationAddress addressBilling;

    …

}

@Entity
@Table(name = "location_address")
public class LocationAddress extends Model {

    @Id
    Long id;

    @Constraints.Required
    @Constraints.MaxLength(TextSize.DEFAULT)
    @Column(length = TextSize.DEFAULT, nullable = false)
    public String street;

    @Constraints.MaxLength(TextSize.TINY)
    @Column(length = TextSize.TINY)
    public String streetNo;

    @ManyToOne(cascade = CascadeType.PERSIST, optional = false)
    public Country country;

    …

    @OneToOne(mappedBy = "address")
    public AppUser userAddress;

    @OneToOne(mappedBy = "addressBilling")
    public AppUser userAddressBilling;

    @OneToOne(mappedBy = "address")
    public AdvertisingLocation advertisingLocationAddress;

    // -- Queries

    public static Finder<Long, LocationAddress> find = new Finder<Long, LocationAddress>(Long.class, LocationAddress.class);

    public static List<LocationAddress> all() {
        return find.all();
    }

    public static LocationAddress findById(long id) {
        return find.byId(id);
    }

}

The problem is that LocationAddress.all() returns nothing, and thus AppUser.findById(1).address.street throws EntityNotFoundException: Bean has been deleted - lazy loading failed. Needless to say, the database table is not empty.
Interestingly, Ebean.find(LocationAddress.class).findRowCount() returns 3 (this is correct).
Anyone seeing what could be the issue? Thank you.

A:

After many more hours I finally found the source of the problem. @OneToOne fields in LocationAddress are not needed and cause the entity not be returned if null.

