Package org.hibernate.envers.tools.query

Examples of org.hibernate.envers.tools.query.Parameters


    public void addEntityAtRevisionRestriction(GlobalConfiguration globalCfg, QueryBuilder rootQueryBuilder,
      String revisionProperty,String revisionEndProperty, boolean addAlias,
            MiddleIdData idData, String revisionPropertyPath, String originalIdPropertyName,
            String alias1, String alias2) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();
    addRevisionRestriction(rootParameters, revisionProperty, revisionEndProperty, addAlias);
  }
View Full Code Here


 
  public void addAssociationAtRevisionRestriction(QueryBuilder rootQueryBuilder,  String revisionProperty,
        String revisionEndProperty, boolean addAlias, MiddleIdData referencingIdData,
        String versionsMiddleEntityName, String eeOriginalIdPropertyPath, String revisionPropertyPath,
        String originalIdPropertyName, MiddleComponentData... componentDatas) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();
    addRevisionRestriction(rootParameters, revisionProperty, revisionEndProperty, addAlias);
  }
View Full Code Here

    private void addRevisionRestriction(Parameters rootParameters, 
      String revisionProperty, String revisionEndProperty, boolean addAlias) {
     
    // e.revision <= _revision and (e.endRevision > _revision or e.endRevision is null)
    Parameters subParm = rootParameters.addSubParameters("or");
    rootParameters.addWhereWithNamedParam(revisionProperty, addAlias, "<=", REVISION_PARAMETER);
    subParm.addWhereWithNamedParam(revisionEndProperty + ".id", addAlias, ">", REVISION_PARAMETER);
    subParm.addWhere(revisionEndProperty, addAlias, "is", "null", false);
  }
View Full Code Here

   
  public void addEntityAtRevisionRestriction(GlobalConfiguration globalCfg, QueryBuilder rootQueryBuilder, String revisionProperty,
      String revisionEndProperty, boolean addAlias, MiddleIdData idData, String revisionPropertyPath,
      String originalIdPropertyName, String alias1, String alias2) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();
   
    // create a subquery builder
        // SELECT max(e.revision) FROM versionsReferencedEntity e2
        QueryBuilder maxERevQb = rootQueryBuilder.newSubQueryBuilder(idData.getAuditEntityName(), alias2);
        maxERevQb.addProjection("max", revisionPropertyPath, false);
        // WHERE
        Parameters maxERevQbParameters = maxERevQb.getRootParameters();
        // e2.revision <= :revision
        maxERevQbParameters.addWhereWithNamedParam(revisionPropertyPath, "<=", "revision");
        // e2.id_ref_ed = e.id_ref_ed
        idData.getOriginalMapper().addIdsEqualToQuery(maxERevQbParameters,
                alias1 + "." + originalIdPropertyName, alias2 +"." + originalIdPropertyName);
   
    // add subquery to rootParameters
View Full Code Here

  public void addAssociationAtRevisionRestriction(QueryBuilder rootQueryBuilder,  String revisionProperty,
            String revisionEndProperty, boolean addAlias, MiddleIdData referencingIdData, String versionsMiddleEntityName,
            String eeOriginalIdPropertyPath, String revisionPropertyPath,
            String originalIdPropertyName, MiddleComponentData... componentDatas) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();

      // SELECT max(ee2.revision) FROM middleEntity ee2
        QueryBuilder maxEeRevQb = rootQueryBuilder.newSubQueryBuilder(versionsMiddleEntityName, "ee2");
        maxEeRevQb.addProjection("max", revisionPropertyPath, false);
        // WHERE
        Parameters maxEeRevQbParameters = maxEeRevQb.getRootParameters();
        // ee2.revision <= :revision
        maxEeRevQbParameters.addWhereWithNamedParam(revisionPropertyPath, "<=", "revision");
        // ee2.originalId.* = ee.originalId.*
        String ee2OriginalIdPropertyPath = "ee2." + originalIdPropertyName;
        referencingIdData.getPrefixedMapper().addIdsEqualToQuery(maxEeRevQbParameters, eeOriginalIdPropertyPath, ee2OriginalIdPropertyPath);
        for (MiddleComponentData componentData : componentDatas) {
            componentData.getComponentMapper().addMiddleEqualToQuery(maxEeRevQbParameters, eeOriginalIdPropertyPath, ee2OriginalIdPropertyPath);
View Full Code Here

    public void addEntityAtRevisionRestriction(GlobalConfiguration globalCfg, QueryBuilder rootQueryBuilder,
      String revisionProperty,String revisionEndProperty, boolean addAlias,
            MiddleIdData idData, String revisionPropertyPath, String originalIdPropertyName,
            String alias1, String alias2) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();
    addRevisionRestriction(rootParameters, revisionProperty, revisionEndProperty, addAlias);
  }
View Full Code Here

 
  public void addAssociationAtRevisionRestriction(QueryBuilder rootQueryBuilder,  String revisionProperty,
        String revisionEndProperty, boolean addAlias, MiddleIdData referencingIdData,
        String versionsMiddleEntityName, String eeOriginalIdPropertyPath, String revisionPropertyPath,
        String originalIdPropertyName, MiddleComponentData... componentDatas) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();
    addRevisionRestriction(rootParameters, revisionProperty, revisionEndProperty, addAlias);
  }
View Full Code Here

    private void addRevisionRestriction(Parameters rootParameters, 
      String revisionProperty, String revisionEndProperty, boolean addAlias) {
     
    // e.revision <= _revision and (e.endRevision > _revision or e.endRevision is null)
    Parameters subParm = rootParameters.addSubParameters("or");
    rootParameters.addWhereWithNamedParam(revisionProperty, addAlias, "<=", "revision");
    subParm.addWhereWithNamedParam(revisionEndProperty + ".id", addAlias, ">", "revision");
    subParm.addWhere(revisionEndProperty, addAlias, "is", "null", false);
  }
View Full Code Here

   
  public void addEntityAtRevisionRestriction(GlobalConfiguration globalCfg, QueryBuilder rootQueryBuilder, String revisionProperty,
      String revisionEndProperty, boolean addAlias, MiddleIdData idData, String revisionPropertyPath,
      String originalIdPropertyName, String alias1, String alias2) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();
   
    // create a subquery builder
        // SELECT max(e.revision) FROM versionsReferencedEntity e2
        QueryBuilder maxERevQb = rootQueryBuilder.newSubQueryBuilder(idData.getAuditEntityName(), alias2);
        maxERevQb.addProjection("max", revisionPropertyPath, false);
        // WHERE
        Parameters maxERevQbParameters = maxERevQb.getRootParameters();
        // e2.revision <= :revision
        maxERevQbParameters.addWhereWithNamedParam(revisionPropertyPath, "<=", "revision");
        // e2.id_ref_ed = e.id_ref_ed
        idData.getOriginalMapper().addIdsEqualToQuery(maxERevQbParameters,
                alias1 + "." + originalIdPropertyName, alias2 +"." + originalIdPropertyName);
   
    // add subquery to rootParameters
View Full Code Here

  public void addAssociationAtRevisionRestriction(QueryBuilder rootQueryBuilder,  String revisionProperty,
            String revisionEndProperty, boolean addAlias, MiddleIdData referencingIdData, String versionsMiddleEntityName,
            String eeOriginalIdPropertyPath, String revisionPropertyPath,
            String originalIdPropertyName, MiddleComponentData... componentDatas) {
    Parameters rootParameters = rootQueryBuilder.getRootParameters();

      // SELECT max(ee2.revision) FROM middleEntity ee2
        QueryBuilder maxEeRevQb = rootQueryBuilder.newSubQueryBuilder(versionsMiddleEntityName, "ee2");
        maxEeRevQb.addProjection("max", revisionPropertyPath, false);
        // WHERE
        Parameters maxEeRevQbParameters = maxEeRevQb.getRootParameters();
        // ee2.revision <= :revision
        maxEeRevQbParameters.addWhereWithNamedParam(revisionPropertyPath, "<=", "revision");
        // ee2.originalId.* = ee.originalId.*
        String ee2OriginalIdPropertyPath = "ee2." + originalIdPropertyName;
        referencingIdData.getPrefixedMapper().addIdsEqualToQuery(maxEeRevQbParameters, eeOriginalIdPropertyPath, ee2OriginalIdPropertyPath);
        for (MiddleComponentData componentData : componentDatas) {
            componentData.getComponentMapper().addMiddleEqualToQuery(maxEeRevQbParameters, eeOriginalIdPropertyPath, ee2OriginalIdPropertyPath);
View Full Code Here

TOP

Related Classes of org.hibernate.envers.tools.query.Parameters

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.