question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ObjectMapperCustomizer with Hibernate5Module for lazyloading

See original GitHub issue

Describe the bug Jackson ObjectMapperCustomizer not working as expected.

Expected behavior If the Hibernate5Module would be set with the Hibernate5Module.Feature.SERIALIZE_IDENTIFIER_FOR_LAZY_NOT_LOADED_OBJECTS feature, i would expect that on every jax-rs endpoint with the jackson module would use the given Objectmapper feature. So that lazy loaded relations would shown only as id lists.

Actual behavior Getting Lazyloading execptions.

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/cerias/quarkus-debug-jackson-objectmapper
  2. setup database with one entity of TestA and TestB
  3. Open /swagger-ui and trigger GET

Configuration

also in the example repo.

Environment (please complete the following information):

  • Output of uname -a or ver: Linux huffelpuff 5.1.1-050101-generic #201905110631 SMP Sat May 11 06:33:50 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

  • Output of java -version: OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)

  • GraalVM version (if different from Java): 19.0.2

  • Quarkus version or git rev: 0.25

It is also possible im not using the hibernate feature wrong. 😉

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:7
  • Comments:25 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
EfraimLAcommented, Feb 14, 2020

Is there some plan to resolve this?

2reactions
fabriicommented, Jan 22, 2021

We also need this feature in our project. We need Proxys to be ignored from Serialization. Thanks!

– Edit:

Is there any way of using this method in quarkus?:

Hibernate.isInitialized(entity.getCollection()).

It always returns true in my case. If we have a way to check if the collection is initialized or not, we can implement a custom serializer.

Thanks

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spring seems to be ignoring Hibernate5Module and lazy ...
Spring seems to be ignoring Hibernate5Module and lazy loading of hibernate object · Ask Question. Asked 9 months ago. Modified 9 months ago....
Read more >
Hibernate5Module.Feature (Jackson-datatype-Hibernate5 2.8 ...
This feature determines how PersistentCollection s properties for which no annotation is found are handled with respect to lazy-loading: if true, ...
Read more >
com.fasterxml.jackson.datatype.hibernate5.Hibernate5Module ...
protected Hibernate5Module createHibernate5Module() { Hibernate5Module module ... HibernateのLazyLoading回避対応。 see JacksonAutoConfiguration */ @Bean ...
Read more >
Quarkus Versions - Open Source Agenda
... large multipart messages; #24283 - JBoss Threads version logging in tests; #4644 - ObjectMapperCustomizer with Hibernate5Module for lazyloading ...
Read more >
Attribute Lazy Loading And Jackson Serialization - Wix.com
Motivation: From performance perspective, we must avoid loading from the database more data than needed. Attribute lazy loading allows us to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found