Note that there are some explanatory texts on larger screens.

plurals
  1. PO@Embedded Reference on Entity Giving java.lang.stackoverflow
    text
    copied!<p>We have the following error when attempting to use an @Embedded object in Morphia on Play.</p> <pre><code>A java.lang.StackOverflowError has been caught, null Hide trace java.lang.StackOverflowError at java.util.LinkedHashMap.init(LinkedHashMap.java:223) at java.util.HashMap.(HashMap.java:210) at java.util.LinkedHashMap.(LinkedHashMap.java:181) at org.bson.BasicBSONObject.(BasicBSONObject.java:39) at com.mongodb.BasicDBObject.(BasicDBObject.java:42) at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:435) at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:430) at com.google.code.morphia.mapping.EmbeddedMapper.writeCollection(EmbeddedMapper.java:68) at com.google.code.morphia.mapping.EmbeddedMapper.toDBObject(EmbeddedMapper.java:30) </code></pre> <p>This is caused by trying to save an instance of the following class:</p> <pre><code>@Entity public class Profile extends Model { @Embedded public class ObjectPermission { public String type; public ArrayList&lt;String&gt; viewable; public ArrayList&lt;String&gt; editable; } public String _sfid; public String _type; @Embedded public ArrayList&lt;ObjectPermission&gt; object; } </code></pre> <p>We are attempting to save it in the following way:</p> <pre><code>@Test public void TestFullProfileSave() { Profile p = new Profile(); p._sfid = "0123456789101213145"; p._type = "entitlements"; ObjectPermission objPerm = p.new ObjectPermission(); objPerm.type = "Account"; objPerm.viewable = new ArrayList&lt;String&gt;(); objPerm.viewable.add("field1"); objPerm.viewable.add("field2"); objPerm.editable = new ArrayList&lt;String&gt;(); objPerm.editable.add("field3"); objPerm.editable.add("field4"); p.object = new ArrayList&lt;ObjectPermission&gt;(); p.object.add(objPerm); p.save(); } </code></pre> <p>I have a feeling it is the ArrayLists but don't know why hence my confusion. Thanks in advance.</p> <p>Paul</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload