I want to achieve a query, which selects all the parent with only children who fill this condition *children.date = today*. The goal is increase performance, i don't need children of other days. 

```
Query q = ss.createQuery("select p from Parent p where exists( from p.children c where    c.date = :now)");
     q.setTimestamp("now", new DateTime().minusDays(1).toDate());
     qc=q.list();

```

Another way :

```
DateMidnight first = new DateMidnight(); //today at 00h00 00min 00 JodaTime
  ss.createCriteria(Parent.class)
      .createAlias("children", "c")
      .add(Restrictions.between("c.date",first.toDate(), first.plus(14400000).toDate()))
      .list();

```

**Parent Class**

```
@Entity
public class Parent implements Serializable {

private static final long serialVersionUID = 1L;
  @Id
  @GeneratedValue(strategy=GenerationType.TABLE)
  private Integer id;

  @OneToMany( cascade = {CascadeType.ALL},mappedBy = "parentId",fetch = FetchType.LAZY)
  @Column(name="id_parent",nullable=true,unique = true)
  @Cascade(value={org.hibernate.annotations.CascadeType.ALL,org.hibernate.annotations.CascadeType.SAVE_UPDATE,org.hibernate.annotations.CascadeType.DELETE,org.hibernate.annotations.CascadeType.REMOVE})
  private List<Child> children=new ArrayList<Child>();

```

and the Child.class

```
@Entity
public class Child implements Serializable{

private static final long serialVersionUID = 1L;
 @Id
@GeneratedValue(strategy=GenerationType.TABLE)
 @Column(name = "childID", unique = true, nullable = false)
private long childId1;

private Date date;

private String childId2;

```