While requesting an entity with a broken OneToOne relationship, no row is returned and no error is raised. The ObjectNotFoundException is logged at INFO level. Giving the following entities, if a MainEntity has a child_id which doesn't exist, null is returned, whereas we could expect an ObjectNotFoundException to be thrown.
@Entity
public class MainEntity {
@Id Integer id;
@OneToOne ChildEntity child;
}
@Entity
public class ChildEntity {
@Id Integer id;
}
Sample code attached with unit test attached. |