This rule checks that Hibernate is only used in the dataaccess layer. In any other layer, JPA should be preferred. Only the use of the org.hibernate.validator package is allowed outside of the dataaccess layer. Regardless of in which layer they are used, the following Hibernate annotations are forbidden:

Also, Hibernate enver implementations and Hibernate internals should never be used directly or outside of the impl scope of a dataaccess layer.

Noncompliant Code Examples

    package com.devonfw.ide.sonarqube.logic.impl;

    import org.hibernate.Session;

    public class MyClass {}

    package com.devonfw.ide.sonarqube.dataaccess.api;

    import org.hibernate.annotations.OrderBy;

    public class MyClass {}

Compliant Solution

    package com.devonfw.ide.sonarqube.dataaccess.impl;

    import org.hibernate.Session;
    import org.hibernate.annotations.FilterDef;
    import org.hibernate.envers.Audited;

    public class MyClass {}