title: Get max revision less than to a particular revision with envers
body: <p>The same question I found with this <a href="https://stackoverflow.com/questions/25723323/find-max-revision-of-each-entity-less-than-or-equal-to-given-revision-with-enver">Link</a></p>
  
  <p>It is working fine but the problem is while I am using <strong>Join</strong>, it is not giving single result, Its returning all Revision less than of given revision.</p>
  
  <p>My code is as below</p>
  
  <pre><code>AuditReader reader = AuditReaderFactory.get(session);
  AuditQueryCreator audQueryCreator = reader.createQuery();
  
  AuditQuery query_cusTagInst = audQueryCreator.forEntitiesAtRevision(CustomTagInstance.class, revision_Id)
                  .add(AuditEntity.revisionNumber().le(revision_Id))
                  .traverseRelation("instrument", JoinType.INNER)
                  .add(AuditEntity.revisionNumber().maximize().computeAggregationInInstanceContext())
                  .add( AuditEntity.property( "instrumentId" ).eq( id ) );
  CustomTagInstance customTagInst = null;
  List list_cusTagInst = query_cusTagInst.getResultList();
  for(int i=0; i&lt;list_cusTagInst.size(); i++){
      customTagInst = (CustomTagInstance) list_cusTagInst.get(i);
  }
  </code></pre>
  
  <p>And </p>
  
  <pre><code>@Audited
  @Table(name = "CUSTOM_TAG_INSTANCE")
  public class CustomTagInstance implements java.io.Serializable {
  
  private Long tagInstanceId;
  private Instrument instrument;
  
  @Id
  @Column(name = "TAG_INSTANCE_ID", unique = true, nullable = false, precision = 22, scale = 0)
  public Long getTagInstanceId() {
      return this.tagInstanceId;
  }
  
  public void setTagInstanceId(Long tagInstanceId) {
      this.tagInstanceId = tagInstanceId;
  }
  
  @ManyToOne(fetch = FetchType.LAZY)
  @JoinColumn(name = "INSTRUMENT_ID")
  public Instrument getInstrument() {
      return this.instrument;
  }
  
  public void setInstrument(Instrument instrument) {
      this.instrument = instrument;
  }
  </code></pre>
  
  <p>Please tell me is there anything that I need to use to get only max revision Less than to given revision.</p>