Uploaded image for project: 'Hibernate ORM'
  1. HHH-11924

ElementCollection ignore converter for XML mapping

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 5.2.10
    • Fix Version/s: 5.2.16, 5.3.0.CR2
    • Component/s: hibernate-core
    • Labels:
      None
    • Environment:
      Windows
    • Bug Testcase Reminder (view):

      Bug reports should generally be accompanied by a test case!

    • Last commented by a user?:
      true

      Description

      If I assign a converter to an elementcollection in XML it fails with an error. But if I do the same but with annotations instead it work fine.

      Unfortunately I can't use annotations in this case and I can't find a work around.

      javax.persistence.PersistenceException: [PersistenceUnit: templatePU] Unable to build Hibernate SessionFactory
      
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.persistenceException(EntityManagerFactoryBuilderImpl.java:967)
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:892)
      	at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:58)
      	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:55)
      	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:39)
      	at org.hibernate.bugs.JPAUnitTestCase.init(JPAUnitTestCase.java:25)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:483)
      	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
      	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
      	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
      	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:24)
      	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
      	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
      	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
      	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
      	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
      	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
      	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
      	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
      	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
      	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
      	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
      	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
      	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
      	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
      Caused by: org.hibernate.MappingException: Could not determine type for: org.hibernate.bugs.model.Comment, at table: Book_comments, for columns: [org.hibernate.mapping.Column(comments)]
      	at org.hibernate.mapping.SimpleValue.getType(SimpleValue.java:455)
      	at org.hibernate.mapping.SimpleValue.isValid(SimpleValue.java:422)
      	at org.hibernate.mapping.Collection.validate(Collection.java:310)
      	at org.hibernate.boot.internal.MetadataImpl.validate(MetadataImpl.java:333)
      	at org.hibernate.boot.internal.SessionFactoryBuilderImpl.build(SessionFactoryBuilderImpl.java:451)
      	at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:889)
      	... 27 more
      
      <?xml version="1.0" encoding="UTF-8"?><entity-mappings xmlns="http://xmlns.jcp.org/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="2.1" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence/orm http://xmlns.jcp.org/xml/ns/persistence/orm_2_1.xsd">
          <entity class="org.hibernate.bugs.model.Book">
              <attributes>
                  <id name="id"/>
                  <basic name="title"/>
                  <element-collection name="comments">
                      <convert converter="org.hibernate.bugs.CommentConverter" />
                  </element-collection>
              </attributes>
          </entity>
      </entity-mappings>
      

        Attachments

          Issue links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Stride room