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

Detect cyclic references (@Embedded) [moved] #47

Closed
jyemin opened this issue Apr 25, 2013 · 1 comment
Closed

Detect cyclic references (@Embedded) [moved] #47

jyemin opened this issue Apr 25, 2013 · 1 comment
Labels
Milestone

Comments

@jyemin
Copy link
Contributor

jyemin commented Apr 25, 2013

This is Issue 47 moved from a Google Code project.
Added by 2010-05-16T12:45:04.000Z by google-a...@codesmell.de.
Please review that bug for more context and additional comments, but update this bug.

Original labels: Type-Enhancement, Priority-Low, Milestone-Icebox

Original description

When embedding an Entity, that itself has a reference to the root Entity,
Morphia (reasonably) produces a StackOverflow.

Don´t know if this easy to detect, so i´d call this a minor issue.

<b>What steps will reproduce the problem?</b>
1. run attached TestCase

<b>What version of the product are you using? On what operating system?</b>
0.93-SNAPSHOT

java.lang.StackOverflowError
    at java.util.HashMap$Entry.<init>(Unknown Source)
    at java.util.LinkedHashMap$Entry.<init>(Unknown Source)
    at java.util.LinkedHashMap.createEntry(Unknown Source)
    at java.util.LinkedHashMap.addEntry(Unknown Source)
    at java.util.HashMap.put(Unknown Source)
    at com.mongodb.BasicDBObject.put(BasicDBObject.java:153)
    at com.google.code.morphia.mapping.Mapper.mapValuesToDBObject(Mapper.java:467)
    at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:282)
    at
com.google.code.morphia.mapping.Mapper.mapEmbeddedToDBObject(Mapper.java:375)
    at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:280)

...
@evanchooly
Copy link
Member

While it's possible to fix the code to deal with this case, there's no support for intra-document references in bson. Until there is, this use case will be unsupported in morphia as well.

fwautobuild pushed a commit to fwHub/morphia that referenced this issue Feb 2, 2021
fwautobuild pushed a commit to fwHub/morphia that referenced this issue Feb 2, 2021
fwautobuild pushed a commit to fwHub/morphia that referenced this issue Feb 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants