Search in sources :

Example 1 with RevisionTypeType

use of org.hibernate.envers.internal.entities.RevisionTypeType in project hibernate-orm by hibernate.

the class TypeContributorImpl method contribute.

@Override
public void contribute(TypeContributions typeContributions, ServiceRegistry serviceRegistry) {
    final EnversService enversService = serviceRegistry.getService(EnversService.class);
    if (!enversService.isEnabled()) {
        return;
    }
    typeContributions.contributeType(new RevisionTypeType(), new String[] { RevisionTypeType.class.getName() });
}
Also used : RevisionTypeType(org.hibernate.envers.internal.entities.RevisionTypeType)

Example 2 with RevisionTypeType

use of org.hibernate.envers.internal.entities.RevisionTypeType in project hibernate-orm by hibernate.

the class QueryBuilder method toQuery.

public Query toQuery(Session session) {
    final StringBuilder querySb = new StringBuilder();
    final Map<String, Object> queryParamValues = new HashMap<>();
    build(querySb, queryParamValues);
    final Query query = session.createQuery(querySb.toString());
    for (Map.Entry<String, Object> paramValue : queryParamValues.entrySet()) {
        if (paramValue.getValue() instanceof RevisionType) {
            // this is needed when the ClassicQueryTranslatorFactory is used
            query.setParameter(paramValue.getKey(), paramValue.getValue(), new CustomType(new RevisionTypeType()));
        } else {
            query.setParameter(paramValue.getKey(), paramValue.getValue());
        }
    }
    return query;
}
Also used : CustomType(org.hibernate.type.CustomType) Query(org.hibernate.query.Query) HashMap(java.util.HashMap) RevisionType(org.hibernate.envers.RevisionType) RevisionTypeType(org.hibernate.envers.internal.entities.RevisionTypeType) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

RevisionTypeType (org.hibernate.envers.internal.entities.RevisionTypeType)2 HashMap (java.util.HashMap)1 Map (java.util.Map)1 RevisionType (org.hibernate.envers.RevisionType)1 Query (org.hibernate.query.Query)1 CustomType (org.hibernate.type.CustomType)1