-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: error - Unable to find a GridType for string
PostPosted: Fri Jul 17, 2015 7:18 am 
Newbie

Joined: Thu Jul 16, 2015 8:03 am
Posts: 5
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?


Top
 Profile  
 
 Post subject: Re: error - Unable to find a GridType for string
PostPosted: Tue Jul 21, 2015 3:24 am 
Hibernate Team
Hibernate Team

Joined: Sat Jan 24, 2009 12:46 pm
Posts: 388
Hi,

I tried to reproduce the issue using your LogEntry entity but it works as expected for me. It's really odd, of course there is support for String. Just to be sure, maybe you accidentally import another "String" type rather than java.lang.String? It's unlikely, but the only explanation coming to my mind. If you can provide a minimal example project (small Maven project, just the concerned entity and code using it) and attach it to an issue in our tracker (https://hibernate.atlassian.net/browse/OGM) I can try and take a closer look.

Cheers,

--Gunnar

_________________
Visit my blog at http://musingsofaprogrammingaddict.blogspot.com/


Top
 Profile  
 
 Post subject: Re: error - Unable to find a GridType for string
PostPosted: Tue Jul 21, 2015 11:06 am 
Newbie

Joined: Thu Jul 16, 2015 8:03 am
Posts: 5
Thank you for your answer Gunnar,

I am back in office on thursday. I will try to reproduce the error in a smaller project and attach it.

cheers
Ruth


Last edited by huehnerlady on Wed Jul 22, 2015 4:06 am, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: error - Unable to find a GridType for string
PostPosted: Thu Jul 23, 2015 5:19 am 
Newbie

Joined: Thu Jul 16, 2015 8:03 am
Posts: 5
I wrote an Issue on your tracker:
https://hibernate.atlassian.net/browse/OGM-863


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.