I have a one-to-one relation like this
The Parent
@JsonAutoDetect
@Entity
@Table(name = \"Parent\")
public class Parent{
private Integer id;
p
First of all, the mapping is wrong. In the parent class, you're saying that the association is mapped by child.parent, and immediately after you're saying that it's mapped using a join column named id_child. Make up your mind. Either it's mapped by the child.parent property, and you should remove the @JoinColumn. Or it's mapped by the JoinColumn and you should remove the @PrimaryKeyJoinColumn in the child, and use mappedBy="child" in the Child entity.
Now, to make your query work, whatever the mapping is, you should simply make an inner join:
Criteria criteria = session.createCriteria(Parent.class);
criteria.createAlias("child"); // inner join
Since the join is an inner join, it will only select parents that have a non-null child.