I have an entity called User with the following property:
@OneToMany(cascade = CascadeType.ALL)@MapKey(name = "id")public Map roles = new HashMap();
Role is also an entity. When I add a Role to the roles map and then save the User, I get the following:
models.Role cannot be cast to java.util.Map$Entry[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveAssocManyDetails(DefaultPersister.java:877)[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveMany(DefaultPersister.java:799)[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveAssocMany(DefaultPersister.java:704)[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.update(DefaultPersister.java:442)[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveEnhanced(DefaultPersister.java:343)[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.saveRecurse(DefaultPersister.java:315)[error] at com.avaje.ebeaninternal.server.persist.DefaultPersister.save(DefaultPersister.java:282)[error] at com.avaje.ebeaninternal.server.core.DefaultServer.save(DefaultServer.java:1577)[error] at com.avaje.ebeaninternal.server.core.DefaultServer.save(DefaultServer.java:1567)[error] at com.avaje.ebean.Ebean.save(Ebean.java:538)
Sample app here: https://github.com/jtjames/ebean-onetomany-map-module