• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

What are the FetchType Lazy and Eager?

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I doo not understand the meaning of LAZY and EAGER exactly.
I have a problem to deploy 2 entities bean with one to many relaionship.
On the one side, default vaule of fetchtype is lazy.
And i have a problem with this message on JBOSS 4.2.1
"org.hibernate.LazyInitializationException: failed to lazily initialize a collection of role: ejb3.Member.spreadsh
eets, no session or session was closed"

If i change the fatchtype to eager on the one side.. another problem is happened
javax.persistence.PersistenceException: org.hibernate.HibernateException: cannot simultaneously fetch multiple bags

|A| 1 ..* |B| 1..* |C|

how should i fix this? and what is exact meaning of fetch?
cheers
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For future references with the problem "cannot simultaneously fetch multiple bags" it seems like a hibernate bug. Check these links:

http://lists.jboss.org/pipermail/hibernate-issues/2006-August/000259.html
http://www.jroller.com/eyallupu/entry/hibernate_exception_simultaneously_fetch_multiple

Regards,
 
She's out of the country right now, toppling an unauthorized dictatorship. Please leave a message with this tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic