Q:

JPA - Lazily loaded entity reference has its fields null

I am using Java 8 and Spring Data JPA with Hibernate.   I am observing a strange behaviour. 
All entity relationships are LAZY loaded. 
Course toBeMatched = //...a repository call to get a course...;

for (Student s : college.getStudents()) {
  if (s.getCourse().equals(toBeMatched)) {
    found = true;
  }
}

My equals() method returns false even for genuine cases.   The implementation of Course#equals is somewhat along these lines:
@Override
public boolean equals(Object obj) {
    if (this == obj)
        return true;

    Course other = (Course) obj;
    if (shortName == null) {
        if (other.shortName ! = null)
            return false;
    } else if (! shortName.equals(other.shortName))
        return false;
    return true;
}

Issue:
My issue is that shortName.equals(other.shortName) fails wrongly, as other.shortName is always null, however, if I use other.getShortName(), I get the value correctly. 
My question is whether I am doing anything fundamentally wrong by accessing fields of lazily loaded entity instead of going through its getter methods. 

A:

Hibernate ORM Returns Proxy objects and lazy loads to support caching and improve performance.  Currently there is no way to intercept calls to Proxy fields thus other.shortName will always be null, Only way is to intercept calls to Proxy methods.  Just like in your case the other.getShortName() is the way to do it.