Suppose we have "Event.hbm.xml" with a "formula" in one of its properties called "name". The formula is a big select statement that I don’t want to call every time I fetch the object.
Hibernate 3 introduced lazy fetching in column level. Meaning that a column in a table can be lazily fetched if you don’t want it in every select of the object. Previously we had lazy in row level, associations and collections.
Suppose the Event class looks like this:
public class Event { private Long id, private String name; "}
and we want to make the column "name" as lazy. So we need lazy="true" in hbm.xml for the "name" property.
So far so good. But this does not work!
Hibernate manual indicates that it "requires build-time bytecode instrumentation" and this has not been explained nowhere properly!
In order to do the "compile time bytecode manipulation" we need the following ant task:
Clik here to view.

It will manipulate the bytecode of "Event" class (after compile) and when we fetch the "Event" class, the "name" property is not fetched until we call event.getName() explicitly. More importantly, we also need to add "javassist.jar" to our jar libraries.
By the way, Hibernate manual says:
This optimization technique is also known as fetch groups. Please note that this is mostly a marketing feature, as in practice, optimizing row reads is much more important than optimization of column reads. However, only loading some properties of a class might be useful in extreme cases, when legacy tables have hundreds of columns and the data model cannot be improved.
With a better design I could avoid this but in my situation I didn’t want to touch the design!