1 Reply Latest reply on Sep 15, 2014 11:30 AM by Divya Dadlani

    List of Strings annotated with @ElementCollection does not work with JPA client

    Jasper Oosterman Newbie

      I have an @Entity class (see attached screenshots) that has a List<String> property annotated with @ElementCollection. The server side hibernate code is generated correctly but when I try to persist an instance using the entitymanager I get the following error:

       

      [ERROR] java.lang.RuntimeException: I don't know how JSONify [] (class java.util.ArrayList)
      [ERROR] at org.jboss.errai.jpa.client.local.JsonUtil.basicValueToJson(JsonUtil.java:91)
      [ERROR] at org.jboss.errai.jpa.client.local.ErraiManagedType.makeInlineJson(ErraiManagedType.java:288)
      [ERROR] at org.jboss.errai.jpa.client.local.ErraiManagedType.toJson(ErraiManagedType.java:149)
      [ERROR] at org.jboss.errai.jpa.client.local.backend.WebStorageBackend.put(WebStorageBackend.java:99)
      [ERROR] at org.jboss.errai.jpa.client.local.ErraiEntityManager.applyCascadingOperation(ErraiEntityManager.java:198)
      [ERROR] at org.jboss.errai.jpa.client.local.ErraiEntityManager.persist(ErraiEntityManager.java:581)
      [ERROR] at nl.wisdelft.prototype.client.local.widgets.EnterDBPediaPageWidget$1.callback(EnterDBPediaPageWidget.java:89)
      [ERROR] at nl.wisdelft.prototype.client.local.widgets.EnterDBPediaPageWidget$1.callback(EnterDBPediaPageWidget.java:1)
      [ERROR] at org.jboss.errai.bus.client.api.builder.DefaultRemoteCallBuilder$1$1.callback(DefaultRemoteCallBuilder.java:106)
      [ERROR] at org.jboss.errai.bus.client.framework.ClientMessageBusImpl$10.callback(ClientMessageBusImpl.java:670)
      [ERROR] at org.jboss.errai.bus.client.framework.ClientMessageBusImpl.sendLocal(ClientMessageBusImpl.java:835)
      [ERROR] at org.jboss.errai.bus.client.util.BusToolsCli.decodeToCallback(BusToolsCli.java:54)
      [ERROR] at org.jboss.errai.bus.client.framework.transports.SSEHandler.handleReceived(SSEHandler.java:147)
      [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      [ERROR] at java.lang.reflect.Method.invoke(Method.java:606)
      [ERROR] at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103)
      [ERROR] at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71)
      [ERROR] at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java:172)
      [ERROR] at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java:293)
      [ERROR] at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java:547)
      [ERROR] at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java:364)
      [ERROR] at java.lang.Thread.run(Thread.java:745)
      

       

      Should @ElementCollection work on the client? Encapsulating the String into another @Entity object does work, but is not the solution I am looking for.

      Kind regards, Jasper