Nathan King

Greenhorn
+ Follow
since Jan 07, 2011
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nathan King

The method below results in the org.hibernate.LazyInitializationException being thrown and I'd appreciate help in understanding why. I'm using JPA 2/Hibernate & Spring.

JPA 2/Hibernate are using the default transaction persistence context, therefore, shouldn't the method below allow for lazy loading?

Note: daoWrapper is a convenience class that wraps entity manager methods; the class itself is also annotated with @Transactional.

I have 4 tables -- store, catalog_galleries, catalog_images, and catalog_financials.

When I traverse the relationship from store --> catalog_galleries --> catalog_images in other words: store.getCatalogGallery().getCatalogImages() I get duplicate records. Does anyone know what could be the cause of this? Any suggestions on where to look?

The store table has a OneToOne relationship with catalog_galleries which in turn has a OneToMany relationship with catalog_images and an eager fetch type. The store table also has a OneToMany relationship with catalog_financials. Note: the catalog_images table does NOT contain duplicate data; however, rows may have the same value in the gallery_id column. This column is a join column between catalog_images and catalog_galleries.

Below are the relevant entities: