Skip to content

Test to demonstrate circular serialization issues. #59

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

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Test to demonstrate circular serialization issues. #59

wants to merge 8 commits into from

Conversation

qlp
Copy link
Contributor

@qlp qlp commented Jun 10, 2013

Deserialization of objects with mybatis proxies fails when having circular
references. Is is an extension of the test created for googlecode issue 614.

This test uses three types:

  • Parent (with reference to a List of Children and Person)
  • Child (with reference to Parent and Person)
  • Person

And executes the folowing scenario:

  1. A Parent is fetched using the ParentMapper
  2. The getChildren() method is invoked on the loaded Parent.
  3. First Child is serialized
  4. Child is deserialized

Result:
Caused by: java.lang.ClassCastException: cannot assign instance of org.apache.ibatis.executor.loader.cglib.CglibSerialStateHolder to field org.apache.ibatis.submitted.serializecircular.Child.parent of type org.apache.ibatis.submitted.serializecircular.Parent in instance of org.apache.ibatis.submitted.serializecircular.Child
at java.io.ObjectStreamClass$FieldReflector.setObjFieldValues(Unknown Source)
at java.io.ObjectStreamClass.setObjFieldValues(Unknown Source)

Deserialization of objects with mybatis proxies fails when having circular
references.
@qlp qlp mentioned this pull request Jun 10, 2013
@emacarron
Copy link
Member

Hi Jurriaan. I did not recognized it was you who opened this issue.

I would bet that only Franta is able to address this problem. Can you just add a comment to the old gcode tracker to see if he is notified (and wants to fix it :) )

Thank you!

@qlp
Copy link
Contributor Author

qlp commented Mar 10, 2014

Hi Eduaro, Looks like Franta took the bait! I'll have a look at his proof of concept, but i'm very busy at the moment; it may take some weeks.

@emacarron
Copy link
Member

Ok. Thank you!!

qlp and others added 6 commits June 18, 2014 10:49
Deserializing cyclic object graphs #59
…re no unloaded properties in the proxy. This means that the proxy can deserialize the wrapped Object.
Deserialization of objects with mybatis proxies fails when having circular
references.
…re no unloaded properties in the proxy. This means that the proxy can deserialize the wrapped Object.
…into serializecircular

Conflicts:
	src/main/java/org/apache/ibatis/executor/loader/AbstractSerialStateHolder.java
	src/main/java/org/apache/ibatis/executor/loader/cglib/CglibSerialStateHolder.java
	src/main/java/org/apache/ibatis/executor/loader/javassist/JavassistSerialStateHolder.java
@qlp
Copy link
Contributor Author

qlp commented Jun 24, 2014

Working on a unittest...

We have an issue with using hashCode with some types and this solution uses a HashSet

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

Successfully merging this pull request may close these issues.

3 participants