Skip to content
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

Unable to fetch resource with LAZY property [DATAREST-1442] #1793

Closed
spring-projects-issues opened this issue Oct 22, 2019 · 1 comment
Closed
Assignees
Labels
status: duplicate type: bug

Comments

@spring-projects-issues
Copy link

@spring-projects-issues spring-projects-issues commented Oct 22, 2019

osst opened DATAREST-1442 and commented

GET request for either a single resource or collection of resources fails with an exception if the resource has LAZY property.

Exception:
com.fasterxml.jackson.databind.exc.InvalidDefinitionException: No serializer found for class org.hibernate.proxy.pojo.bytebuddy.ByteBuddyInterceptor and no properties discovered to create BeanSerializer (to avoid exception, disable SerializationFeature.FAIL_ON_EMPTY_BEANS) (through reference chain: org.springframework.data.rest.webmvc.json.PersistentEntityJackson2Module$PersistentEntityResourceSerializer$1["embedded"]->org.springframework.data.rest.webmvc.PersistentEntityResource$NoLinksResources["_embedded"]->java.util.Collections$UnmodifiableMap["entityA"]->com.codejig.resttest.EntityA$HibernateProxy$w8sAYhND["hibernateLazyInitializer"])

Example entity:

@Entity
public class EntityB {

	@ManyToOne(fetch = FetchType.LAZY)
	private EntityA entityA;
	...
}

With FetchType.EAGER serialization does not fail but resulting JSON does contain unnecessary "_embedded" section


Affects: 3.2 GA (Moore)

Issue Links:

  • DATAREST-1446 DefaultExcerptProjector exposes projection present even if metadata returns Optional.empty()
    ("duplicates")

Referenced from: pull request #365

@spring-projects-issues
Copy link
Author

@spring-projects-issues spring-projects-issues commented Oct 28, 2019

Oliver Drotbohm commented

There was a PR submitted which has been superseded by the fixes made for DATAREST-1446. Reading up the description I am not sure the proposed fix actually fixes the issue here. Still closing as duplicate. Feel free to reopen if you need further things to change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: duplicate type: bug
Projects
None yet
Development

No branches or pull requests

2 participants