org.hibernate.MappingException: Unknown collection role: testcase.hibernate.PersonBase.addresses

Hibernate JIRA | Oliver Ringel | 6 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    I'm trying to get the PluralAttributePath from a collection defined in a MappedSuperclass {code} @Entity public class Person extends PersonBase { @Basic private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } {code} {code} @MappedSuperclass public abstract class PersonBase { @Id private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } @OneToMany() private Set<Address> addresses = new HashSet<Address>(); public Set<Address> getAddresses() { return addresses; } public void setAddresses(Set<Address> addresses) { this.addresses = addresses; } } {code} Executing the following {code} criteriaQuery = criteriaBuilder.createQuery(Person.class); root = criteriaQuery.from(Person.class); Path<?> pathAddresses = root.get("addresses"); {code} throws the exception {noformat} org.hibernate.MappingException: Unknown collection role: testcase.hibernate.PersonBase.addresses at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701) at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58) at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:157) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:197) at testcase.hibernate.HibernateTest.testMappedSuperclassPluralAttribute(HibernateTest.java:53) {noformat}

    Hibernate JIRA | 6 years ago | Oliver Ringel
    org.hibernate.MappingException: Unknown collection role: testcase.hibernate.PersonBase.addresses
  2. 0

    I'm trying to get the PluralAttributePath from a collection defined in a MappedSuperclass {code} @Entity public class Person extends PersonBase { @Basic private String name; public String getName() { return name; } public void setName(String name) { this.name = name; } } {code} {code} @MappedSuperclass public abstract class PersonBase { @Id private String id; public String getId() { return id; } public void setId(String id) { this.id = id; } @OneToMany() private Set<Address> addresses = new HashSet<Address>(); public Set<Address> getAddresses() { return addresses; } public void setAddresses(Set<Address> addresses) { this.addresses = addresses; } } {code} Executing the following {code} criteriaQuery = criteriaBuilder.createQuery(Person.class); root = criteriaQuery.from(Person.class); Path<?> pathAddresses = root.get("addresses"); {code} throws the exception {noformat} org.hibernate.MappingException: Unknown collection role: testcase.hibernate.PersonBase.addresses at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701) at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58) at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:157) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:197) at testcase.hibernate.HibernateTest.testMappedSuperclassPluralAttribute(HibernateTest.java:53) {noformat}

    Hibernate JIRA | 6 years ago | Oliver Ringel
    org.hibernate.MappingException: Unknown collection role: testcase.hibernate.PersonBase.addresses
  3. 0

    Appears to be an inconsistency between org.hibernate.ejb.criteria.path.PluralAttributePath#resolveRole and naming of CollectionPersisters org.hibernate.MappingException: Unknown collection role: test.BookDefinition.bookMarks at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701) at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58) at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:162) at test.Test.testTestSystem(Test.java:136) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:106) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111) at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103) at $Proxy0.invoke(Unknown Source) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69) ... Removed 26 stack frames Click to hide stack frames org.hibernate.MappingException: Unknown collection role: test.BookDefinition.bookMarks at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701) at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58) at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:162) at test.Test.testTestSystem(Test.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76) at org.testng.internal.Invoker.invokeMethod(Invoker.java:673) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.runWorkers(TestRunner.java:1147) at org.testng.TestRunner.privateRun(TestRunner.java:749) at org.testng.TestRunner.run(TestRunner.java:600) at org.testng.SuiteRunner.runTest(SuiteRunner.java:317) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274) at org.testng.SuiteRunner.run(SuiteRunner.java:223) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039) at org.testng.TestNG.runSuitesLocally(TestNG.java:964) at org.testng.TestNG.run(TestNG.java:900) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:106) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103) at $Proxy0.invoke(Unknown Source) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

    Hibernate JIRA | 6 years ago | Paul Nardone
    org.hibernate.MappingException: Unknown collection role: test.BookDefinition.bookMarks
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Appears to be an inconsistency between org.hibernate.ejb.criteria.path.PluralAttributePath#resolveRole and naming of CollectionPersisters org.hibernate.MappingException: Unknown collection role: test.BookDefinition.bookMarks at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701) at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58) at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:162) at test.Test.testTestSystem(Test.java:136) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:106) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111) at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103) at $Proxy0.invoke(Unknown Source) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69) ... Removed 26 stack frames Click to hide stack frames org.hibernate.MappingException: Unknown collection role: test.BookDefinition.bookMarks at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701) at org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58) at org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52) at org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:162) at test.Test.testTestSystem(Test.java:136) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:76) at org.testng.internal.Invoker.invokeMethod(Invoker.java:673) at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:846) at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1170) at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:125) at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109) at org.testng.TestRunner.runWorkers(TestRunner.java:1147) at org.testng.TestRunner.privateRun(TestRunner.java:749) at org.testng.TestRunner.run(TestRunner.java:600) at org.testng.SuiteRunner.runTest(SuiteRunner.java:317) at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:312) at org.testng.SuiteRunner.privateRun(SuiteRunner.java:274) at org.testng.SuiteRunner.run(SuiteRunner.java:223) at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52) at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86) at org.testng.TestNG.runSuitesSequentially(TestNG.java:1039) at org.testng.TestNG.runSuitesLocally(TestNG.java:964) at org.testng.TestNG.run(TestNG.java:900) at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:60) at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:106) at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:111) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.maven.surefire.booter.ProviderFactory$ClassLoaderProxy.invoke(ProviderFactory.java:103) at $Proxy0.invoke(Unknown Source) at org.apache.maven.surefire.booter.SurefireStarter.invokeProvider(SurefireStarter.java:150) at org.apache.maven.surefire.booter.SurefireStarter.runSuitesInProcess(SurefireStarter.java:91) at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:69)

    Hibernate JIRA | 6 years ago | Paul Nardone
    org.hibernate.MappingException: Unknown collection role: test.BookDefinition.bookMarks
  6. 0

    Unknown collection role: Exception

    gilead | 7 years ago | sridheropenid
    org.hibernate.MappingException: Unknown collection role: null

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. org.hibernate.MappingException

      Unknown collection role: testcase.hibernate.PersonBase.addresses

      at org.hibernate.impl.SessionFactoryImpl.getCollectionPersister()
    2. Hibernate
      SessionFactoryImpl.getCollectionPersister
      1. org.hibernate.impl.SessionFactoryImpl.getCollectionPersister(SessionFactoryImpl.java:701)
      1 frame
    3. Hibernate EJB
      AbstractPathImpl.get
      1. org.hibernate.ejb.criteria.path.PluralAttributePath.resolvePersister(PluralAttributePath.java:58)
      2. org.hibernate.ejb.criteria.path.PluralAttributePath.<init>(PluralAttributePath.java:52)
      3. org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:157)
      4. org.hibernate.ejb.criteria.path.AbstractPathImpl.get(AbstractPathImpl.java:197)
      4 frames
    4. testcase.hibernate
      HibernateTest.testMappedSuperclassPluralAttribute
      1. testcase.hibernate.HibernateTest.testMappedSuperclassPluralAttribute(HibernateTest.java:53)
      1 frame