Wednesday, 18 January 2012

Hibernate & Web Applications Issues

  • LazyInitializationException I: OpenSessionInView
  • LazyInitializationException II (next request, HttpSession/saveState detached object)
    • work with IDs (stateless, no session)
    • lock(LockMode.NONE)
    • programmatically initialize
    • FetchType.EAGER
  • NonUniqueObjectException (next request, on lock): change statement order
  • StaleObjectException: optmistic locking using @Version
  • HibernateException: Illegal attempt to associate a collection with two open sessions
    • HttpSession object synchronization Filter