javamongodbgridfshibernate-ogm

org.bson.codecs.configuration.CodecConfigurationException: Can't find a codec for class org.hibernate.ogm.datastore.mongodb.type.GridFS


I'm trying to experiment with GridFS in Hibernate-ogm. This is simply my class

import org.hibernate.ogm.datastore.mongodb.type.GridFS;

@Embeddable
public class MyEntity implements Serializable{

    private String name;

    public MyEntity () {
    }

    GridFS list;
}

I get the error in title at runtime when I try to make this entity persistent. Eclipse IDE on list field says "Attribute list has invalid mapping type in this context".


Solution

  • Currently, the GridFS type doesn't work with associations. You can only use it as an attribute of an entity.

    There is an issue for this: https://hibernate.atlassian.net/browse/OGM-1553 You can also find some more information in the forum: https://discourse.hibernate.org/t/org-hibernate-hibernateexception-ogm000080-could-not-load-an-entity-batch/2148