Skip to main content
How are we doing? Please help us improve Stack Overflow. Take our short survey

All Questions

0 votes
1 answer
530 views

JPA lazy insert

There's many posts about lazy fetching in JPAs like e.g. Hibernate. However, I couldn't find one mentioning lazy insert. Let's say my DAO has a List attribute with public getter and setter. Instead ...
Hugo G's user avatar
  • 16.6k
6 votes
2 answers
4k views

Dynamic Eager & Lazy Loading in Hibernate

I'm new to Hibernate, but have plenty of experience with the Entity Framework in C#. One feature I love is the ability to dynamically decide what to load immediately in a query. For example, consider ...
AirmanAJK's user avatar
  • 111
1 vote
2 answers
2k views

Eager loading despite Lazy Initialization?

we have an entity that has a lot of ManyToOne, OneToOne, etc relations which themself have again some relations. For example @OneToMany(targetEntity = Season.class, cascade = { CascadeType.ALL })...
Urr4's user avatar
  • 793
1 vote
1 answer
46 views

ssh4 LazyInitializationException

here is stack: org.hibernate.LazyInitializationException: could not initialize proxy - no Session org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:164) org....
pandita's user avatar
  • 21
0 votes
1 answer
878 views

session.disconnect() vs Open Session In View(OSIV) which is better?

As per the "Hibernate in action" the best solution of lazy initialization exception is that to use a centralized code from where we can get the session or instead of doing session.close() use session....
user528050's user avatar
15 votes
3 answers
75k views

Hibernate could not initialize proxy - no Session

My code retrieves all information related to the user: SessionFactory sessionFactory = HibernateUtilities.configureSessionFactory(); Session session = sessionFactory.openSession(); UserDetails ud = ...
KyelJmD's user avatar
  • 4,722
1 vote
2 answers
4k views

@ManyToMany initiating LazyInitializationException

For the some testing purposes, I'm trying to have JUnit test throwing LazyInitializationException. My case is that I have 3 entities @Entity(name = "Role") public class Role { @LazyCollection(...
Peter Butkovic's user avatar
0 votes
1 answer
193 views

Hibernate + OSIV. 2 transactions. Repeatable read

This article states that if we use 2 transactions one for getting first data and afterwords to get the lazy fields, we won't run into any problems since the session is reused and the session itself ...
Stanislav Bashkyrtsev's user avatar
1 vote
1 answer
331 views

lazy fetching problem

I have a problem with lazy fetching. here's what I have. I have a entity class called channel. and another entity class called show. Each channel has many show's. I've implemented hibernate with lazy ...
karq's user avatar
  • 859
0 votes
2 answers
4k views

Proper use of getHibernateTemplate() in Spring MVC app?

I have a bunch of Hibernate mapped objects in my Spring MVC app. Default seems to be lazy loading for nested objects with relations. I realized this by getting a lot of errors in my JSP when accessing ...
Czar's user avatar
  • 366
0 votes
1 answer
578 views

Recommendation for using equals in Entities and avoiding LazyInitializationExceptions?

In the beginning there is a problem that wants to be solved. In my case i got an LazyInitializationException while using indexof in a Collection to retrieve an Object for manipulation. Here i start to ...
huxendupsel's user avatar