Those who use hibernate for database access know that you need to provide an information that this object is a hibernate object. To do so you typically need to annotate your object with @Entity. It’s not a problem although if we speak about some large system. In large systems we have typically a number of instances of the same object that represent the same table in different contexts and packages. And here we need this: to give each object unique name.
Example:
@Entity(name="person.usa") class Person { ... }
This PMD rule shows how to check if a hibernate object have a name.
<![CDATA[ //Annotation/NormalAnnotation[ ( Name/@Image='Entity' and not ( MemberValuePairs/MemberValuePair/@Image='name' and //PrimaryExpression/PrimaryPrefix[contains(Literal/@Image,'.')] ) ) ]]]>
Senior Software Engineer developing all kinds of stuff.