In my app i am using Hibernate OGM to persist data in MongoDB. I have the following structure of classes:
Historic:
@Entity(name = "historic")
public class Historic {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Type(type = "objectid")
private String id;
@ElementCollection
private List<Information> informations;
private Double pctDocumented;
private boolean actual;
}
Information (It is not an entity):
public class Information {
private String infoType;
private boolean documented;
private boolean implemented;
private Map<String, String> settings;
}
And when i try to initialize my EntityManagerFactory, i get the following error:
Exception in thread "main" javax.persistence.PersistenceException: [PersistenceUnit: ogm] Unable to build Hibernate SessionFactory
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at br.com.app.Main.main(Main.java:53)
Caused by: org.hibernate.MappingException: Could not determine type for: java.util.Map, at table: historico_informations, for columns: [org.hibernate.mapping.Column(settings)]
When i comment the line with:
private Map<String, String> settings;
it works properly. If i put this Map attribute in Historic class it works too. The only difference between then is one is an Entity and other isn't. Any ideias?