tomee-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Struberg <strub...@yahoo.de.INVALID>
Subject Re: Johnzon is going to infinite loop on JPA entities with OneToMany relationship
Date Thu, 19 Jul 2018 19:57:26 GMT
Sadly there is no common handling for this in the current spec. 
I've already created a ticket [1], but this will only be available as of JakartaEE9.

You should be able to swap out Johnzon-1.0.x with 1.1.8.
Then use the following JsonbConfig and set "johnzon.deduplicateObjects" to true.
 
Happy to get feedback about this feature!

LieGrue,
strub



[1] https://github.com/eclipse-ee4j/jsonb-api/issues/72

> Am 19.07.2018 um 19:40 schrieb Romain Manni-Bucau <rmannibucau@gmail.com>:
> 
> 1.1 supports reference handling but not the 1.0 of tomee 7.
> 
> Le jeu. 19 juil. 2018 19:17, Matthew Broadhead
> <matthew.broadhead@nbmlaw.co.uk.invalid> a écrit :
> 
>> JAXB used to use @XmlInverseReference annotation.  is there no such
>> johnzon annotation?  @JohnzonIgnore is more like @Transient?
>> 
>> On 19/07/18 17:10, Romain Manni-Bucau wrote:
>>> Hi Sudhakar,
>>> 
>>> Ensure you have a @JohnzonIgnore on one side to avoid a loop.
>>> 
>>> Romain Manni-Bucau
>>> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
>>> <https://rmannibucau.metawerx.net/> | Old Blog
>>> <http://rmannibucau.wordpress.com> | Github <
>> https://github.com/rmannibucau> |
>>> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
>>> <
>> https://www.packtpub.com/application-development/java-ee-8-high-performance
>>> 
>>> 
>>> 
>>> Le jeu. 19 juil. 2018 à 16:46, sudhakarvm <sudhakarvm@gmail.com> a
>> écrit :
>>> 
>>>> I am facing problem while json is generated from my JPA model object
>> using
>>>> default JSON provider Johnzon.
>>>> This JPA entity class B has @ManyToOne relationship with other entity A.
>>>> Since A also includes B as @OneToMany member with List datatype.
>> Because of
>>>> this Johnzon is going in infinite loop to prepare the json and I am
>> getting
>>>> following exception:
>>>> 
>>>> /Caused by: javax.json.stream.JsonGenerationException: Invalid json
>>>>         at
>>>> 
>>>> 
>> org.apache.johnzon.core.JsonGeneratorImpl.close(JsonGeneratorImpl.java:437)/
>>>> 
>>>> JPA (using eclipselink) is returning correct results. Any suggestions
>> for
>>>> this issue please.
>>>> 
>>>> Thanks in advance
>>>> Sudhakar
>>>> 
>>>> 
>>>> 
>>>> --
>>>> Sent from:
>>>> http://tomee-openejb.979440.n4.nabble.com/TomEE-Users-f979441.html
>>>> 
>> 
>> 


Mime
View raw message