We're using Hibernate to load objects that meet certain criteria. If the user decides to view the details on one of the objects, I want to pull up some additional information about the object. One of the "attributes" I'd like to show will require a fairly complex SQL query, but evaluates to a simple boolean.
What's the right way to do this with Hibernate? Is there a way to indicate a property whose value is the result of a SQL query? If so, is there a way to prevent the query from being invoked until it's needed?
Or am I approaching this incorrectly?