I am using JPA with Hibernate persistence provider.
I have one to many mapping, I used
@OneToMany(mappedBy = "mSearchPreference", cascade = CascadeType.ALL, fetch=FetchType.EAGER)
I can see the one to many SQL statements on the console, eventhough i am getting the exception
illegal access to loading collection (hibernate.LazyInitializationException)
org.hibernate.LazyInitializationException: illegal access to loading collection
at org.hibernate.collection.AbstractPersistentCollection.initialize(AbstractPersistentCollection.java:341)
at org.hibernate.collection.AbstractPersistentCollection.read(AbstractPersistentCollection.java:86)
at org.hibernate.collection.AbstractPersistentCollection.readElementExistence(AbstractPersistentCollection.java:142)
at org.hibernate.collection.PersistentSet.add(PersistentSet.java:187)
Can someone help me out what other arrangements I need to do?