Hey
I wrote a little test programm for different databases. now I want to add cassandra, but I get an Error with one field.
Code:
INFO: OGM000001: Hibernate OGM 4.2.0.Final
javax.persistence.PersistenceException: [PersistenceUnit: cassandra] Unable to build Hibernate SessionFactory
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:1249)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.access$600(EntityManagerFactoryBuilderImpl.java:120)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:860)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:398)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
at org.hibernate.ogm.jpa.HibernateOgmPersistence.createEntityManagerFactory(HibernateOgmPersistence.java:63)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
at de.motza.ogm.test.HibernateUtil.getEntityManager(HibernateUtil.java:49)
at de.motza.ogm.test.History_Log.test_writing_power(History_Log.java:240)
at de.motza.ogm.test.History_Log.testNewDatabase(History_Log.java:168)
at de.motza.ogm.test.History_Log.main(History_Log.java:39)
Caused by: org.hibernate.MappingException: Could not get constructor for org.hibernate.ogm.persister.impl.SingleTableOgmEntityPersister
at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:185)
at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:135)
at org.hibernate.internal.SessionFactoryImpl.<init>(SessionFactoryImpl.java:401)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1859)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
... 11 more
Caused by: org.hibernate.HibernateException: OGM000068: Could not configure property de.motza.entities.LogEntry#activity
at org.hibernate.ogm.persister.impl.OgmEntityPersister.<init>(OgmEntityPersister.java:285)
at org.hibernate.ogm.persister.impl.SingleTableOgmEntityPersister.<init>(SingleTableOgmEntityPersister.java:35)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at org.hibernate.persister.internal.PersisterFactoryImpl.create(PersisterFactoryImpl.java:163)
... 15 more
Caused by: org.hibernate.HibernateException: OGM000059: Unable to find a GridType for string
at org.hibernate.ogm.type.impl.TypeTranslatorImpl.getType(TypeTranslatorImpl.java:85)
at org.hibernate.ogm.persister.impl.OgmEntityPersister.<init>(OgmEntityPersister.java:282)
... 21 more
The Entity with the problematic property:
Code:
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "LogEntry", namespace = "http://www.rohde-schwarz.de/schemas/types/logEntry", propOrder = {
"id", "log_index", "code", "date", "level", "activity",
"component", "resource", "parameters", "serverErrorCode", "userName", "objectName", "parametersList"
})
@Entity
// @Table(name = "HISTORY_LOG")
@Indexed
public class LogEntry {
public enum LEVEL {
error,
warning,
info;
}
public static final String TYPE_NAME = "LogEntry";
public static final String DEFAULT_USERNAME = "SYSTEM";
public static final String AVHE_CONTROL_USERNAME = "AVHE_CONTROL";
@XmlElement(required = true)
@Id
private String id = "GUID_FOR_EMPTY";
@XmlElement(required = true, name = "index")
@Field(analyze = Analyze.NO)
private long log_index = 0;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String code;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private long date;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
@Enumerated(EnumType.STRING)
private LEVEL level;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String activity;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String resource;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String component;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String serverErrorCode;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String objectName;
@XmlElement(required = true)
@Field(analyze = Analyze.NO)
private String userName = DEFAULT_USERNAME;
@XmlElement(required = true)
@Transient
private Map<String, String> parameters = new HashMap<>();
@OneToMany(cascade = CascadeType.ALL)
@IndexedEmbedded
private Set<Parameter> parametersList;
public LogEntry() {
for (Entry<String, String> entry : parameters.entrySet()) {
parametersList.add(new Parameter(log_index, entry.getKey(), entry.getValue()));
}
}
//Getters and Setters,hashcode, toString and so on
}
I use a maven project, mongoDB, mySQL and PostgreSQL work fine...
does anybody know what I did wrong?
edit: i started my trial and it seems that the problem is the newer core I use. because since I use 4.2.0 the problem appears for mongoDB, too.
But for using the cassandra driver I need core 4.2.0 any hints?