openjpa-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daryl Stultz <>
Subject Re: equals, hashcode, toString, etc, and field access
Date Fri, 28 May 2010 12:22:33 GMT
On Thu, May 27, 2010 at 8:49 PM, Trenton D. Adams <>wrote:

> I mean I know if I'm doing lazy loading, toString won't get all the data,
> cause it hasn't been enhanced.

Assuming the object is detached, yes. I believe the JPA spec does not
specify the behavior for attempted access of an unloaded property on a
detached entity. I believe OpenJPA returns null. This makes it very
difficult to tell if an association is null or not loaded. I have configured
OpenJPA to disallow access to unloaded properties of detached entities to
avoid the confusion. This means a toString method like yours in my project
could crash.

Daryl Stultz
6 Degrees Software and Consulting, Inc.

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message