title: Hibernate Criteria using restrictions
body: <p>I have an entity as</p>
  
  <pre><code>public class CommissionSummary {    
      @Id
      @GeneratedValue(strategy = GenerationType.AUTO)
      private Long id;
      @Column(length = 100)
      private String advisorCode;
      @Column(length = 100)
      private String advisorName;
      private String advisorCodeParent;
      @Column(length = 100)
      private String advisorNameParent;
      @Column(length = 100)
      private String advisorPost;
      @Column
      private Double percentage;
      @Column
      private Double diffPercentage;
      @Column
      private Double saleAmount;
      @Column
      private Long saleCount;
      @Column
      **private Double commissionAmount;
      @Column
      private Integer month;
      @Column
      private Integer year;**
      //Getter Setter
  }
  </code></pre>
  
  <p>On screen user is entering criteria to fetch the date between 2 dates.</p>
  
  <p>Ex. From 01/Jan/2012 till 30/Jul/2012.</p>
  
  <p>In CommissionSummary entity does not have date column, but it has month and year 2 separate columns.</p>
  
  <p>I want to fetch CommissionSummary records for the period from date and to date given by user, based on month and year column.</p>
  
  <p>So how to achieve this using Hibernate Criteria / Restrictions? </p>
  
  <p>Note: Day field does not have any sense in user inputted from and to date.</p>