From the book, it states

Let's override the SQL statement Hibernate uses when loading the Item#images collection. This is
a collection of embeddable components mapped with @ElementCollection; the procedure is the
same for collections of basic types or many-valued entity associations
(@OneToMany or @ManyToMany):


But, @OneToMany throws NullPointerExceptions. It appears that this has been an issue for all of Hibernate 3 and 4. Is this fixed in Hibernate 5?

Could you provide a working example?
So far it seems that way which has basically made the book pretty useless for me.