Hibernate OGM doesn’t have a GridFS annotation.
An example of using GridFS with OGM is the following:
import org.hibernate.ogm.datastore.mongodb.options.GridFSBucket;
import org.hibernate.ogm.datastore.mongodb.type.GridFS;
@Entity
public class Photo {
public static final String BUCKET_NAME = "photos";
@Id
private String id;
@GridFSBucket(BUCKET_NAME)
private GridFS gridfs;
private GridFS gridfsWithDefaultBucket;
// ...
As long as you use the GridFS type from OGM you can store any byte[] or InputStream in it.
You can see the test on GitHub: https://github.com/hibernate/hibernate-ogm/tree/master/mongodb/src/test/java/org/hibernate/ogm/datastore/mongodb/test/gridfs