1 Reply Latest reply on Mar 18, 2013 7:55 PM by savvas.andreas

    Error when mapping with  @ElementCollection

    savvas.andreas

      Hello,

       

      I am attempting to implement a test which uses an Entity that has a @ElementCollection mapping defined. The corresponding code is similar to the following:

       

       

      @Entity

      public class SomeEntity implements Serializable {

       

          private static final long serialVersionUID = 1L;

          @ElementCollection

          private Collection<SomeEmbeddableClass> someEmbeddableClasses = new ArrayList<>();

           ...................................................................................

      }

       

       

      @Embeddable

      public class SomeEmbeddableClass implements Serializable {

       

          private static final long serialVersionUID = 1L;

          ...................................................................................

      }

       

       

      I am using a remote glassfish deployment and my pom.xml with all the versions information is the following:

       

      .......................................................................................

      <dependencyManagement>

              <dependencies>

                  <dependency>

                      <groupId>org.jboss.arquillian</groupId>

                      <artifactId>arquillian-bom</artifactId>

                      <version>1.0.3.Final</version>

                      <scope>import</scope>

                      <type>pom</type>

                  </dependency>

              </dependencies>

          </dependencyManagement>

          <build>

              <plugins>

                  <plugin>

                      <artifactId>maven-compiler-plugin</artifactId>

                      <version>3.0</version>

                      <configuration>

                          <source>1.7</source>

                          <target>1.7</target>

                      </configuration>

                  </plugin>

                  <plugin>

                      <artifactId>maven-surefire-plugin</artifactId>

                      <version>2.13</version>

                  </plugin>

              </plugins>

          </build>

          <dependencies>

              <dependency>

                  <groupId>junit</groupId>

                  <artifactId>junit</artifactId>

                  <version>4.11</version>

                  <scope>test</scope>

              </dependency>

              <dependency>

                  <groupId>org.jboss.arquillian.junit</groupId>

                  <artifactId>arquillian-junit-container</artifactId>

                  <scope>test</scope>

              </dependency>

          </dependencies>

          <profiles>

              <profile>

                  <id>arquillian-glassfish-remote</id>

                  <dependencies>

                      <dependency>

                          <groupId>org.jboss.spec</groupId>

                          <artifactId>jboss-javaee-6.0</artifactId>

                          <version>1.0.0.Final</version>

                          <type>pom</type>

                          <scope>provided</scope>

                      </dependency>

                      <dependency>

                          <groupId>org.jboss.weld</groupId>

                          <artifactId>weld-api</artifactId>

                          <version>1.1.Final</version>

                          <scope>test</scope>

                      </dependency>

                      <dependency>

                          <groupId>org.jboss.arquillian.container</groupId>

                          <artifactId>arquillian-glassfish-remote-3.1</artifactId>

                          <version>1.0.0.CR3</version>

                          <scope>test</scope>

                      </dependency>

                  </dependencies>

              </profile>

          </profiles>

      .......................................................................................

       

       

      Now, when I run my test I get the following exception:

       

      Internal Exception: Exception [EclipseLink-7155] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.ValidationException

      Exception Description: The type [class jpa2.objectrelationalmapping.SomeEmbeddableClass] for the attribute [someEmbeddableClasses] on the entity class [class jpa2.objectrelationalmapping.SomeEntity] is not a valid type for a serialized mapping. The attribute type must implement the Serializable interface.. Please see server.log for more details. [status: CLIENT_ERROR reason: Bad Request]

      com.sun.jersey.api.container.ContainerException: exit_code: FAILURE, message: Error occurred during deployment: Exception while preparing the app : Exception [EclipseLink-28018] (Eclipse Persistence Services - 2.3.2.v20111125-r10461): org.eclipse.persistence.exceptions.EntityManagerSetupException

      Exception Description: Predeployment of PersistenceUnit [test] failed.

       

       

      All other Entity mappings work just fine.

      The @Embeddable class is clearly implementing the Serializable interface. Am I missing something in my configuration?

       

       

      Thanks very much,

      Savvas