I'm afraid that there is not a direct solution :
from the documentation (
http://www.hibernate.org/hib_docs/v3/reference/en/html/objectstate.html, section 10.5) :
Quote:
(...) Furthermore, the notion of mass operations conflicts with object/relational mapping for online transaction processing-oriented applications. Future versions of Hibernate may however provide special mass operation functions. See Chapter 13, Batch processing for some possible batch operation tricks.
referenced chapter (
http://www.hibernate.org/hib_docs/v3/reference/en/html/batch.html) explains how to prevent out of memory exceptions and increase performance when the set of inserted objects is large enough.