Skip to content

fix REPLACE_PERSISTENT_COLLECTIONS in EAGER #146

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -342,29 +342,31 @@ private void initializeCollection(PersistentCollection coll, Session session) {
*/
protected boolean usesLazyLoading(BeanProperty property) {
if (property != null) {

boolean replaceCollection = Hibernate5Module.Feature.REPLACE_PERSISTENT_COLLECTIONS.enabledIn(_features);
// As per [Issue#36]
ElementCollection ec = property.getAnnotation(ElementCollection.class);
if (ec != null) {
return (ec.fetch() == FetchType.LAZY);
return replaceCollection || (ec.fetch() == FetchType.LAZY);
}
OneToMany ann1 = property.getAnnotation(OneToMany.class);
if (ann1 != null) {
return (ann1.fetch() == FetchType.LAZY);
return replaceCollection || (ann1.fetch() == FetchType.LAZY);
}
OneToOne ann2 = property.getAnnotation(OneToOne.class);
if (ann2 != null) {
return (ann2.fetch() == FetchType.LAZY);
return replaceCollection || (ann2.fetch() == FetchType.LAZY);
}
ManyToOne ann3 = property.getAnnotation(ManyToOne.class);
if (ann3 != null) {
return (ann3.fetch() == FetchType.LAZY);
return replaceCollection || (ann3.fetch() == FetchType.LAZY);
}
ManyToMany ann4 = property.getAnnotation(ManyToMany.class);
if (ann4 != null) {
return (ann4.fetch() == FetchType.LAZY);
return replaceCollection || (ann4.fetch() == FetchType.LAZY);
}
// As per [Issue#53]
return !Feature.REQUIRE_EXPLICIT_LAZY_LOADING_MARKER.enabledIn(_features);
return !Hibernate5Module.Feature.REQUIRE_EXPLICIT_LAZY_LOADING_MARKER.enabledIn(_features);
}
return false;
}
Expand Down