0

I am trying to run hibernate-ogm (5.0.3.Final) for Mongodb (3.2.10) on Wildfly 10 (10.1.0). I have an entity called User mapped to collection users in mongodb and containing list of permissions. When I try to deploy I get the following exception

Caused by: org.hibernate.MappingException: Could not determine type for: java.util.List, at table: users, for columns: [org.hibernate.mapping.Column(permissions)] at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:396) at org.hibernate.tuple.PropertyFactory.buildEntityBasedAttribute(PropertyFactory.java:157) at org.hibernate.tuple.entity.EntityMetamodel.(EntityMetamodel.java:208) at org.hibernate.persister.entity.AbstractEntityPersister.(AbstractEntityPersister.java:509) at org.hibernate.ogm.persister.impl.OgmEntityPersister.(OgmEntityPersister.java:199) at org.hibernate.ogm.persister.impl.SingleTableOgmEntityPersister.(SingleTableOgmEntityPersister.java:34) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:96) at org.hibernate.persister.internal.PersisterFactoryImpl.createEntityPersister(PersisterFactoryImpl.java:77) at org.hibernate.internal.SessionFactoryImpl.(SessionFactoryImpl.java:346) at org.hibernate.ogm.boot.impl.OgmSessionFactoryBuilderImpl.build(OgmSessionFactoryBuilderImpl.java:54) at org.hibernate.ogm.boot.impl.OgmSessionFactoryBuilderImpl.build(OgmSessionFactoryBuilderImpl.java:23) at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:879) ... 12 more

The entity User is mentioned below:

@Entity(name = "users")
class User extends TableGeneratedId {
  @NotNull
  @BeanProperty var username: String = _

  @NotNull
  @BeanProperty var password: String = _

  @ElementCollection
  @BeanProperty var permissions: util.List[String] = _
}

I am using Scala 2.12.0.

Not sure if I am missing any jar or something? The entity persistence and merging works fine if I remove the list.

I followed all the points mentioned in the Wildfly ref documentation at https://docs.jboss.org/hibernate/stable/ogm/reference/en-US/html_single/?v=5.0#ogm-mongodb but no luck. Any help will be greatly appreciated.

Sandeep M
  • 11
  • 2
  • Could it be related to the way Scala create the java class? This kind of mapping should work – Davide D'Alto Nov 25 '16 at 12:19
  • Maybe it doesn't add the generic to the list: it creates List instead of List – Davide D'Alto Nov 25 '16 at 12:20
  • @Davide , thanks for your reply. I converted the scala class to java and the exception went away. I now get a new exception for ConcurrentModificationException during deployment. Any idea? I am totally lost on this one.. – Sandeep M Nov 25 '16 at 22:11
  • Figured it out! I had an entity containing elementcollection of embeddable. The embeddable in turn had another elementcollection of string values. I removed this string value collection and now its working fine! – Sandeep M Nov 25 '16 at 22:50

0 Answers0